查看文件: editbig5.php
大小: 4.39 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php $picpath= "/products/"; $write=''; if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $aeimg=$_POST['aeimg']; $aeimgext=$_POST['aeimgext']; $tfile="fileToUpload1"; if($_FILES[$tfile]["name"]<>''){ $imgext=''; $ext= explode('.',$_FILES[$tfile]['name']) ; $aeimgext=strtolower($ext[count($ext)-1]); //取最後一筆 $pic=$wwwpath.$picpath.$aeimg.".".$aeimgext; move_uploaded_file($_FILES[$tfile]["tmp_name"],$pic); } $updateSQL = sprintf("update big5link set aedoc='%s',aelink='%s',aeimg='%s',aeimgext='%s',linktag='%s' WHERE ae1='%s'",$_POST['aedoc'],$_POST['aelink'],$aeimg,$aeimgext,$_POST['linktag'],$_POST['ae1']);//$_POST['ae1'] mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $write='資料已更新...'; $insertGoTo = $_POST['url']; // header(sprintf("Location: %s", $insertGoTo)); echo "<script>alert('".$write."');location.href='".$_POST['url']."';</script>"; } $bid=-1; if(isset($_GET['id'])){ $bid=$_GET['id']; } mysql_select_db($database_BE2, $BE2); //$query_Rt2 = sprintf("SELECT a.*,b.* FROM ap1 as a ,adpic as b WHERE a.raid=b.bid AND b.id='%s'",$bid); $query_Rt2 = sprintf("SELECT * FROM big5link where ae1='%s'",$bid); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); // if($myadmin){ echo $query_Rt2; } ?> <form id="form1" name="form1" method="POST" enctype="multipart/form-data" action=""> <table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <th nowrap="nowrap" class="font2" > </th> <th colspan="5" nowrap="nowrap" class="font2" ><?= $row_Rt2['aedoc']?></th> </tr> <tr> <th nowrap="nowrap" class="font2" > </th> <th nowrap="nowrap" class="font2" >圖片說明</th> <th nowrap="nowrap" class="font2" >連結</th> <th nowrap="nowrap" class="font2" >連結模式</th> <th nowrap="nowrap" class="font2" >排序 </th> <th nowrap="nowrap" class="font2" >開啟使用</th> </tr> <tr > <td> </td> <td> <? $aeimg=($row_Rt2['aeimg']=="")?date("YmdHis").sprintf("%04d",rand(1,9999)):$row_Rt2['aeimg']; ?> <input name="ae1" type="hidden" id="ae1" value="<?= $row_Rt2['ae1'];?>" /> <input name="aeimg" type="hidden" id="aeimg" value="<?= $aeimg?>" /> <input name="aeimgext" type="hidden" id="aeimgext" value="<?= $row_Rt2['aeimgext']?>" /> </td> <td><input name="aelink" type="text" id="aelink" value="<? echo $row_Rt2['aelink'];?>" size="40" /></td> <td><label for="select"></label> <select name="linktag" id="linktag"> <option value="_blank" <?php if (!(strcmp("_blank", $row_Rt2['linktag']))) {echo "selected=\"selected\"";} ?>>開新視窗</option> <option value="_self" <?php if (!(strcmp("_self", $row_Rt2['linktag']))) {echo "selected=\"selected\"";} ?>>無</option> </select></td> <td colspan="2"> </td> </tr> <tr> <td> </td> <th align="right">說明</th> <td><textarea name="aedoc" cols="40" rows="4" id="aedoc"><? echo $row_Rt2['aedoc'];?></textarea></td> <td> </td> <td colspan="2"> <? $pic=$wwwpath.$picpath.$aeimg.".".$row_Rt2['aeimgext']; $img=(file_exists($pic))?$picpath.$aeimg.".".$row_Rt2['aeimgext']:""; ?> <img src="<?= $img;?>" alt="" id="webpicid"/></td> </tr> <tr> <td> </td> <td colspan="2"><input name="fileToUpload1" type="file" id="fileToUpload1" /> () </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2">PS:picture = 150 X 150</td> <td> </td> <td><input type="submit" name="Submit" value="送出" /></td> <td> </td> </tr> </table> <input name="MM_update" type="hidden" id="MM_update" value="form1"> <input name="url" type="hidden" id="url" value="<? echo $_SERVER['HTTP_REFERER']; ?>" /> </form> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表