查看文件: logo_tr_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")) { $write=''; $imgpath= '/www2/skybni/travel/trimg/'; $tfile1="fileToUpload1"; $tbimg=$_POST['tbimg']; if($_FILES[$tfile1]["name"]<>''){ $ext1= explode('.',$_FILES[$tfile1]['name']) ; $imgext1=strtolower($ext1[count($ext1)-1]); //取最後一筆 if($imgext1=='png'){ $tbimg=date('is',time()); $logo_image=sprintf("%04d",$_POST['tb0']).$tbimg.'.png'; $pic1=$imgpath.$logo_image; move_uploaded_file($_FILES[$tfile1]["tmp_name"],$pic1); }else{ $write='errpng'; } } $updateSQL = sprintf("UPDATE travel SET tb2=%s,tb3=%s, tbimg=%s, tbindex=%s where tb0=%s", GetSQLValueString($_POST['tb2'], "text"), GetSQLValueString($_POST['tb3'], "text"), GetSQLValueString($tbimg, "text"), GetSQLValueString($_POST['tbindex'], "int"), GetSQLValueString($_POST['tb0'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $updateGoTo =$_POST['url']; if( $write=='errpng'){ echo "<script>alert('僅限上傳 PNG 檔');location.href='".$updateGoTo."';</script>"; }else{ 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 travel WHERE tb0 = %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); ?> <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"> </th> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"">主圖:</th> <td valign="middle"><input name="fileToUpload1" type="file" id="fileToUpload1"> 130 x 108px </td> <? $imgpath= '/www2/skybni/travel/trimg/'; $logo_image=sprintf("%04d",$row_R1['tb0']).$row_R1['tbimg'].'.png'; if($row_R1['tbimg']==''){ $logo_image='tr_bg_'.sprintf("%07d",$row_R1['tb0']).'.png'; } if(! file_exists($imgpath.$logo_image)){$logo_image= 'blank.png';} ?> <td width="26%" rowspan="3" valign="baseline"><img src="/travel/trimg/<?= $logo_image; ?>" width="130" alt="logo" /></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"">分類:</th> <td valign="middle"><input name="tb2" type="text" id="tb2" value="<?= $row_R1['tb2']; ?>" size="32" /></td> </tr> <tr valign="baseline"> <th width="16%" height="38" align="center" valign="middle" nowrap="nowrap">排序值:</th> <td width="58%" valign="baseline"><input name="tbindex" type="text" id="tbindex" value="<?= $row_R1['tbindex']; ?>" size="32" /></td> </tr> <tr valign="baseline"> <td height="30" align="center" valign="middle" nowrap="nowrap">啟用:</td> <td height="30" align="left" valign="middle" nowrap="nowrap"><label for="select"></label> <select name="tb3" id="tb3"> <option value="Y" <? if($row_R1['tb3']=='Y'){ echo 'selected="selected"'; } ?>>Y</option> <option value="N" <? if($row_R1['tb3']=='N'){ echo 'selected="selected"' ;} ?>>N</option> </select></td> <td align="left" valign="middle" nowrap="nowrap"> </td> </tr> <tr valign="baseline"> <td height="34" colspan="3" align="center" valign="middle" nowrap="nowrap">PS: 僅限上傳<font color="red"> PNG</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="tb0" id="tb0" value="<?= $row_R1['tb0']; ?>" /> <input type="hidden" name="tbimg" id="tbimg" value="<?= $row_R1['tbimg']; ?>" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> </form> <?php mysql_free_result($R1); ?>
保存
取消
返回文件列表