查看文件: logo_video_edit.php
大小: 9.83 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=''; if(isset($_POST['city']) && isset($_POST['vkid']) ) { $vkidzone =""; $vkid = $_POST['vkid']; foreach ($vkid as $svkid =>$value) { $vkidzone .= $value .','; } $cityzone =""; $city = $_POST['city']; foreach ($city as $scity=>$value) { $cityzone .= $value .','; } $imgpath= '/www2/skybni/video_img/logo/'; $tfile1="fileToUpload1"; $tfile2="fileToUpload2"; $vimg=$_POST['vimg']; $vimg2=$_POST['vimg2']; if($_FILES[$tfile1]["name"]<>''){ $ext1= explode('.',$_FILES[$tfile1]['name']) ; $imgext1=strtolower($ext1[count($ext1)-1]); //取最後一筆 if($imgext1=='png'){ $vimg=date('is',time()); $logo_image=sprintf("%04d",$_POST['vid']).$vimg.'.png'; $pic1=$imgpath.$logo_image; move_uploaded_file($_FILES[$tfile1]["tmp_name"],$pic1); }else{ $write='errpng'; } } if($_FILES[$tfile2]["name"]<>''){ $ext2= explode('.',$_FILES[$tfile2]['name']) ; $imgext2=strtolower($ext2[count($ext2)-1]); //取最後一筆 if($imgext2=='png'){ $vimg2=date('is',time()); $logo_image2='dis'.sprintf("%04d",$_POST['vid']).$vimg2.'.png'; $pic2=$imgpath.$logo_image2; move_uploaded_file($_FILES[$tfile2]["tmp_name"],$pic2); }else{ $write='errpng'; } } $vdoc=strip_tags($_POST['vdoc']); $updateSQL = sprintf("UPDATE video_master SET vdoc=%s, vimg=%s, vimg2=%s, vindex=%s,vflag=%s,video=%s,vlink=%s,vkid=%s ,vzone=%s where vid=%s", GetSQLValueString($vdoc, "text"), GetSQLValueString($vimg, "text"), GetSQLValueString($vimg2, "text"), GetSQLValueString($_POST['vindex'], "int"), GetSQLValueString($_POST['vflag'], "text"), GetSQLValueString($_POST['video'], "text"), GetSQLValueString($_POST['vlink'], "text"), GetSQLValueString($vkidzone, "text"), GetSQLValueString($cityzone, "text"), GetSQLValueString($_POST['vid'], "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>"; } } // end isset city //$_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 video_master WHERE vid = %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); $ar1=explode(',',$row_R1['vzone']); mysql_select_db($database_BE2, $BE2); $query_R3 = "SELECT * FROM city_img where 1 order by ctid" ; $R3 = mysql_query($query_R3, $BE2) or die(mysql_error()); $row_R3 = mysql_fetch_assoc($R3); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">廣告影片-logo-編輯</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"> </th> </tr> <tr valign="baseline"> <th height="23" align="center" valign="middle" nowrap="nowrap"">主圖:</th> <td valign="middle"><input name="fileToUpload1" type="file" id="fileToUpload1"> 130 x 108px </td> <? $imgpath= '/video_img/logo/'; $logo_image=sprintf("%04d",$row_R1['vid']).$row_R1['vimg'].'.png'; $logo_image2='dis'.sprintf("%04d",$row_R1['vid']).$row_R1['vimg2'].'.png'; ?> <td width="26%" rowspan="8" valign="baseline"><img src="/video_img/logo/<?= $logo_image; ?>" width="130" alt="logo" /><br><br><img src="/video_img/logo/<?= $logo_image2; ?>" width="130" alt="logo" /></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"">探索圖:</th> <td valign="middle"><input name="fileToUpload2" type="file" id="fileToUpload2"> 寬800px </td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"">分類:</th> <td valign="middle"> <? /* <select name="vkid" id="vkid" disabled> <option value="旅遊網" <? if($row_R1['vkid']=="旅遊網"){ echo 'selected="selected"'; }?> >旅遊網</option> <option value="購物網" <? if($row_R1['vkid']=="購物網"){ echo 'selected="selected"'; }?>>購物網</option> <option value="VIP會員網" <? if($row_R1['vkid']=="VIP會員網"){ echo 'selected="selected"'; }?>>VIP會員網</option> </select> */ ?> <? $vkidarr=array("旅遊網","購物網","VIP會員網"); $ra1=explode(",",$row_R1['vkid']); ?> <table width="100" border="1" cellpadding="1" cellspacing="0"> <tr> <td nowrap="nowrap"><input name="vkid[]" type="checkbox" id="vkid[]" value="<?= $vkidarr[0]; ?>" <?= in_array($vkidarr[0],$ra1)?'checked="checked"':'' ;?> /><?= $vkidarr[0]; ?></td> <td nowrap="nowrap"><input name="vkid[]" type="checkbox" id="vkid[]" value="<?= $vkidarr[1]; ?>" <?= in_array($vkidarr[1],$ra1)?'checked="checked"':'' ;?>/><?= $vkidarr[1]; ?></td> <td nowrap="nowrap"><input name="vkid[]" type="checkbox" id="vkid[]" value="<?= $vkidarr[2]; ?>" <?= in_array($vkidarr[2],$ra1)?'checked="checked"':'' ;?>/><?= $vkidarr[2]; ?></td> </tr> </table></td> </tr> <tr valign="baseline"> <th height="38" align="center" valign="middle" nowrap="nowrap">片/圖檔:</th> <td valign="middle"><select name="video" id="video"> <option value="Y" <? if($row_R1['video']=="Y"){ echo 'selected="selected"'; }?>>影片</option> <option value="N" <? if($row_R1['video']=="N"){ echo 'selected="selected"'; }?>>圖檔</option> </select></td> </tr> <tr valign="baseline"> <th height="38" align="center" valign="middle" nowrap="nowrap">展示區域:<br> 全選:<input name="ckall" id="ckall" type="checkbox" value="Y" onclick="check_all(this,'city[]')" /></th> <td valign="middle"> <table border="1" cellpadding="1" cellspacing="0"> <tr> <? $i=0; do{ if(($i%4==0) && ($i>0)){ echo '</tr><tr>' ;} $i++; ?> <td nowrap="nowrap"><input name="city[]" type="checkbox" id="city[]" value="<?= $row_R3['ctname']; ?>" <? if(in_array($row_R3['ctname'],$ar1)){ echo 'checked="checked"' ;} ?>/> <label for="city[]"> <?= $row_R3['ctname']; ?> </label></td> <?php } while ($row_R3 = mysql_fetch_assoc($R3)); ?> </tr> </table> </td> </tr> <tr valign="baseline"> <th width="16%" height="38" align="center" valign="middle" nowrap="nowrap">說明:</th> <td valign="middle"><input name="vdoc" type="text" id="vdoc" value="<?= $row_R1['vdoc']; ?>" size="32" /></td> </tr> <tr valign="baseline"> <th height="38" align="center" valign="middle" nowrap="nowrap">Link:</th> <td valign="middle"><input name="vlink" type="text" id="vlink" value="<?= $row_R1['vlink']; ?>" size="32" /></td> </tr> <tr valign="baseline"> <th height="38" align="center" valign="middle" nowrap="nowrap">排序值:</th> <td valign="middle"><input name="vindex" type="text" id="vindex" value="<?= $row_R1['vindex']; ?>" 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="vkid"></label> <select name="vflag" id="vflag"> <option value="Y" <? if($row_R1['vflag']=='Y'){ echo 'selected="selected"'; } ?>>Y</option> <option value="N" <? if($row_R1['vflag']=='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="34" colspan="3" align="center" valign="middle" nowrap="nowrap"> </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="vid" id="vid" value="<?= $row_R1['vid']; ?>" /> <input type="hidden" name="vimg" id="vimg" value="<?= $row_R1['vimg']; ?>" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> <input type="hidden" name="vimg2" id="vimg2" value="<?= $row_R1['vimg2']; ?>" /> </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> <script type="text/javascript"> function check_all(obj,cName) { var checkboxs = document.getElementsByName(cName); for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;} } </script> <?php mysql_free_result($R1); ?>
保存
取消
返回文件列表