查看文件: line_edit.php
大小: 4.53 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $upfile= $_POST['limg']; $tfile1="fileToUpload1"; if($_FILES[$tfile1]["name"]<>''){ $ext1= explode('.',$_FILES[$tfile1]['name']) ; $imgext1=strtolower($ext1[count($ext1)-1]); //取最後一筆 $imgextarr=array('png','jpg','jpeg','gif'); if( in_array($imgext1,$imgextarr)){ $lcode='logo'.date('YmdHis'); $upfile=$lcode.'.'.$imgext1; $pic1='/www2/skybni/images/line/'.$upfile; move_uploaded_file($_FILES[$tfile1]["tmp_name"],$pic1); } } $updateSQL = sprintf("UPDATE line_img SET lurl=%s,lurlbase=%s, ldoc=%s, limg=%s where lid=%s", GetSQLValueString($_POST['lurl'], "text"), GetSQLValueString($_POST['lurlbase'], "text"), GetSQLValueString($_POST['ldoc'], "text"), GetSQLValueString($upfile, "text"), GetSQLValueString($_POST['lid'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $updateGoTo =$_POST['url'];// "main.php?act=user";"main.php?act=user"; // header(sprintf("Location: %s", $insertGoTo)); echo "<script>location.href='".$updateGoTo."';</script>"; //$_GET['id']=$_POST['lid']; } //echo $updateSQL; $colname_Rt2 = "-1"; if (isset($_GET['id'])) { $colname_Rt2 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']); } mysql_select_db($database_BE2, $BE2); $query_R1 = sprintf("SELECT * FROM line_img WHERE lid = %s", $colname_Rt2); $R1 = mysql_query($query_R1, $BE2) or die(mysql_error()); $row_R1 = mysql_fetch_assoc($R1); $totalRows_R1 = mysql_num_rows($R1); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">LINE-image 編輯</h3> </div> <form action="" method="post" name="form1" id="form1" enctype="multipart/form-data"> <table width="50%" align="center"> <tr valign="baseline"> <th height="38" colspan="3" align="center" valign="middle" nowrap="nowrap"> <? $iurl="https://skybni.com".$row_R1['lurlbase']; ?> <a href="<?= $iurl ?>" target="_blank"> <?= $iurl ;?></a></th> </tr> <tr valign="baseline"> <th height="38" align="center" valign="middle" nowrap="nowrap">URL 目錄:</th> <td valign="middle"><input name="lurlbase" type="text" id="lurlbase" value="<?= $row_R1['lurlbase']; ?>" size="32" /></td> <td align="center" valign="middle">PS root: /</td> </tr> <tr valign="baseline"> <th height="38" align="center" valign="middle" nowrap="nowrap">URL 名稱:</th> <td valign="middle"><input name="lurl" type="text" id="lurl" value="<?= $row_R1['lurl']; ?>" size="32" /></td> <td align="center" valign="middle">PS: index</td> </tr> <tr valign="baseline"> <th height="38" align="right" valign="middle" nowrap="nowrap">主圖區塊:</th> <td valign="middle"><input name="fileToUpload1" type="file" id="fileToUpload1" /></td> <td width="35%" rowspan="2" valign="baseline"><img src="/images/line/<?= $row_R1['limg']; ?>" width="180" alt="logo" /></td> </tr> <tr valign="baseline"> <th width="16%" height="38" align="right" valign="top" nowrap="nowrap">頁面說明:</th> <td width="49%" valign="baseline"><textarea name="ldoc" cols="32" rows="4" id="ldoc"><?= $row_R1['ldoc']; ?> </textarea></td> </tr> <tr valign="baseline"> <td height="34" colspan="3" align="center" valign="middle" nowrap="nowrap">PS: 僅限上傳<font color="red"> PNG,JPG</font> 檔</td> </tr> <tr valign="baseline"> <td height="40" colspan="3" align="center" valign="middle" nowrap="nowrap"><input type="submit" value="更新" /></td> </tr> </table> <input type="hidden" name="MM_update" id="MM_update" value="form1" /> <input type="hidden" name="lid" id="lid" value="<?= $row_R1['lid']; ?>" /> <input type="hidden" name="limg" id="limg" value="<?= $row_R1['limg']; ?>" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> </form> <div id="back"><a href="javascript:history.back();"><img src="images/back.gif" alt="回上一頁" title="回上一頁" width="115" height="32" border="0"></a></div> </div> </div> </div> <?php mysql_free_result($R1); ?>
保存
取消
返回文件列表