查看文件: show_banner.php
大小: 4.31 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php $bannerpath= "home"; $write=''; if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL =''; for($i=1;$i<=$_POST['mycount'];$i++){ $flag="flag".$i; $updateSQL = sprintf("UPDATE banner_pic SET flag = '%s', doc='%s', link='%s' ,ind ='%s' WHERE id ='%s'",$_POST[$flag],$_POST['doc'.$i],$_POST['link'.$i],$_POST['ind'.$i],$_POST['id'.$i]); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $write='資料已更新...'; } } if ((isset($_POST["MM_bannerfile"])) && ($_POST["MM_bannerfile"] == "bannerfile")) { $tfile="fileToUpload1"; if ($_FILES[$tfile]["name"]<>'') { $ext= explode('.',$_FILES[$tfile]['name']) ; $ext_name=strtolower($ext[count($ext)-1]); //取最後一筆 $img=$bannerpath.'-'.$_POST['pic_id'].".".$ext_name; $pic=$wwwpath.'/banner/'.$img; move_uploaded_file($_FILES[$tfile]["tmp_name"],$pic); $updateSQL = sprintf("UPDATE banner_pic SET img ='%s' WHERE id ='%s'",$img,$_POST['pic_id']); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $write='圖檔'.$_POST['pic_id'].'已更新...'; } } mysql_select_db($database_BE2, $BE2); $query_Rt2 = "SELECT * FROM banner_pic WHERE web='home' ORDER BY xid ASC" ; $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); ?> <? if($write<>''){ ?> <SCRIPT LANGUAGE='javascript'> alert('<? echo $write ;?>'); </SCRIPT> <? }?> <form id="form1" name="form1" method="POST" action=""> <table width="68%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <th width="5%" nowrap="nowrap" class="font2" >順序</th> <th width="25%" nowrap="nowrap" class="font2" >圖片說明</th> <th width="40%" nowrap="nowrap" class="font2" >連結</th> <th width="8%" nowrap="nowrap" class="font2" >排序 </th> <th width="22%" nowrap="nowrap" class="font2" >開啟使用</th> </tr> <?php $i=0;?> <?php do { $i++; ?> <tr > <td><?php echo $i; ?></td> <td><input name="doc<? echo $i?>" type="text" id="doc<? echo $i?>" value="<?php echo $row_Rt2['doc']; ?>" /> <input name="id<? echo $i?>" type="hidden" id="id<? echo $i?>" value="<?php echo $row_Rt2['id']; ?>" /></td> <td><input name="link<? echo $i?>" type="text" id="link<? echo $i?>" value="<?php echo $row_Rt2['link']; ?>" size="40" /></td> <td><input name="ind<? echo $i?>" type="text" id="ind<? echo $i?>" value="<?php echo $row_Rt2['ind']; ?>" size="8" maxlength="5" /></td> <td><select name="flag<? echo $i?>"> <option value="Y" <? if($row_Rt2['flag']=='Y'){ ?> selected="selected" <? } ?>>Y</option> <option value="N" <? if($row_Rt2['flag']=='N'){ ?> selected="selected" <? } ?>>N</option> </select></td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr> <td> </td> <td colspan="2"> </td> <td><input name="mycount" type="hidden" id="mycount" value="<? echo $totalRows_Rt2;?>" /></td> <td><input type="submit" name="Submit" value="送出" /></td> </tr> </table> <input type="hidden" name="MM_update" value="form1"> </form> <div align="center"><br> <? /* for($i=0;$i<6;$i++){ ?> 圖<? echo $i+1;?><img src="../banner/<? echo $i +1;?>-b.jpg" /><BR> <? } */ ?> <br> <br> </div> <table width="85%" border="0" align="center" cellpadding="0" cellspacing="5"> <tr> <td width="645"><form method="post" name="form2" enctype="multipart/form-data" action=""> <input name="MM_bannerfile" type="hidden" id="MM_bannerfile" value="bannerfile" /> 上傳圖檔編號 <select name="pic_id" id="pic_id"> <option value="1">圖1</option> <option value="2">圖2</option> <option value="3">圖3</option> <option value="4">圖4</option> <option value="5">圖5</option> <option value="6">圖6</option> </select> <input name="fileToUpload1" type="file" id="fileToUpload1" /> <input type="submit" name="Submit2" value="確認更新圖檔" /> (圖檔寬730X高360 jpg) </form></td> </tr> </table> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表