查看文件: logo_tr_add.php
大小: 4.24 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")) { mysql_select_db($database_BE2, $BE2); $query_R1 = "SELECT tb0 FROM travel WHERE 1 order by tb0 desc limit 1"; $R1 = mysql_query($query_R1, $BE2) or die(mysql_error()); $row_R1 = mysql_fetch_assoc($R1); $totalRows_R1 = mysql_num_rows($R1); $tb0=$row_R1['tb0']+1; mysql_free_result($R1); $write=''; // $imgpath= '/www2/skybni/shopmap/images/'; $imgpath= '/www2/skybni/travel/trimg/'; $tfile1="fileToUpload1"; $tbimg=''; //lbg_ext001 2001 lbg_ext002 2002 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",$tb0).$tbimg.'.png'; $pic1=$imgpath.$logo_image; move_uploaded_file($_FILES[$tfile1]["tmp_name"],$pic1); }else{ $write='errpng'; } } $updateSQL = sprintf("INSERT INTO travel (tb1,tb2,tb3,tbc,tbimg,tbindex)VALUES(%s,%s,%s,%s,%s,%s)", GetSQLValueString($_POST['tb2'], "text"), GetSQLValueString($_POST['tb2'], "text"), GetSQLValueString($_POST['tb3'], "text"), GetSQLValueString($_POST['tbc'], "text"), GetSQLValueString($tbimg, "text"), GetSQLValueString($_POST['tbindex'], "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>alert('上傳完成 ..');location.href='".$updateGoTo."';</script>"; } //$_GET['id']=$_POST['lid']; } mysql_select_db($database_BE2, $BE2); $query_R1 = "SELECT tb0 FROM travel WHERE 1 order by tb0 desc limit 1"; $R1 = mysql_query($query_R1, $BE2) or die(mysql_error()); $row_R1 = mysql_fetch_assoc($R1); $totalRows_R1 = mysql_num_rows($R1); $tbindex=($row_R1['tb0']+1)*100; mysql_free_result($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> <td width="26%" rowspan="3" valign="baseline"> </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="" 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="<?= $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" selected="selected" >Y</option> <option value="N">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="tbc" id="tbc" value="旅遊網" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> </form>
保存
取消
返回文件列表