查看文件: logo_video_add.php
大小: 8.19 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")) { //if(isset($_POST['vkid'])){ 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 .','; } mysql_select_db($database_BE2, $BE2); $query_R1 = "SELECT vid FROM video_master WHERE 1 order by vid 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); $vid=$row_R1['vid']+1; mysql_free_result($R1); $write=''; // $imgpath= '/www2/skybni/shopmap/images/'; $imgpath= '/www2/skybni/video_img/logo/'; $tfile1="fileToUpload1"; $tfile2="fileToUpload2"; $vimg=date('is',time()); $vimg2=date('is',time()); //lbg_ext001 2001 lbg_ext002 2002 if($_FILES[$tfile1]["name"]<>''){ $ext1= explode('.',$_FILES[$tfile1]['name']) ; $imgext1=strtolower($ext1[count($ext1)-1]); //取最後一筆 if($imgext1=='png'){ $logo_image=sprintf("%04d",$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'){ $logo_image2='dis'.sprintf("%04d",$vid).$vimg2.'.png'; $pic2=$imgpath.$logo_image2; move_uploaded_file($_FILES[$tfile2]["tmp_name"],$pic2); }else{ $write='errpng'; } } $vdoc=strip_tags($_POST['vdoc']); $vlink=$_POST['vlink']; $updateSQL = sprintf("INSERT INTO video_master (vkid,vdoc,vindex,vflag,video,vlink,vzone,vimg,vimg2)VALUES(%s,%s,%s,%s,%s,%s,%s ,%s,%s)", GetSQLValueString($vkidzone, "text"), //GetSQLValueString($_POST['vkid'], "text"), GetSQLValueString($vdoc, "text"), GetSQLValueString($_POST['vindex'], "int"), GetSQLValueString($_POST['vflag'], "text"), GetSQLValueString($_POST['video'], "text"), GetSQLValueString($vlink, "text"), GetSQLValueString($cityzone, "text"), GetSQLValueString($vimg2, "text"), GetSQLValueString($vimg, "text") ); 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>"; } } // end isset vzone //$_GET['id']=$_POST['lid']; } 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="2" 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> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">探索圖:</th> <td valign="middle"><input name="fileToUpload2" type="file" id="fileToUpload2" /></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">分類:</th> <td valign="middle"> <? $vkidarr=array("旅遊網","購物網","VIP會員網"); ?> <? /* <select name="vkid" id="vkid"> for($i=0;$i<count($vkidarr);$i++){?> <option value="<?= $vkidarr[$i] ?>"> <?= $vkidarr[$i] ?> </option> </select> <? */ ?> <table width="100" border="1" cellpadding="1" cellspacing="0"> <tr> <td nowrap="nowrap"><input name="vkid[]" type="checkbox" id="vkid[]" value="<?= $vkidarr[0]; ?>" /><?= $vkidarr[0]; ?></td> <td nowrap="nowrap"><input name="vkid[]" type="checkbox" id="vkid[]" value="<?= $vkidarr[1]; ?>" /><?= $vkidarr[1]; ?></td> <td nowrap="nowrap"><input name="vkid[]" type="checkbox" id="vkid[]" value="<?= $vkidarr[2]; ?>" /><?= $vkidarr[2]; ?></td> </tr> </table></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">影片/圖檔</th> <td valign="middle"><select name="video" id="video"> <option value="Y">影片</option> <option value="N">圖檔</option> </select></td> </tr> <tr valign="baseline"> <th height="42" 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']; ?>" /> <label for="city[]"> <?= $row_R3['ctname']; ?> </label></td> <?php } while ($row_R3 = mysql_fetch_assoc($R3)); ?> </tr> </table> </td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">說明:</th> <td valign="middle"><label for="select2"></label> <input name="vdoc" type="text" id="vdoc" value="" size="32" /></td> </tr> <tr valign="baseline"> <th width="19%" height="38" align="center" valign="middle" nowrap="nowrap">排序值:</th> <td width="58%" valign="baseline"><input name="vindex" type="text" id="vindex" value="100" 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"><input name="vlink" type="text" id="vlink" 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="vflag" id="vflag"> <option value="Y" selected="selected" >Y</option> <option value="N">N</option> </select></td> </tr> <tr valign="baseline"> <td height="34" colspan="2" align="center" valign="middle" nowrap="nowrap">PS: 僅限上傳<font color="red"> PNG</font> 檔</td> </tr> <tr valign="baseline"> <td height="40" colspan="2" 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 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> <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> <? mysql_free_result($R3); ?>
保存
取消
返回文件列表