查看文件: ad_news.php
大小: 6.18 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_GET['check_id'])) && ($_GET['check_id'] != "")) { $deleteSQL = sprintf("update news set fn='C' WHERE id=%s ",$_GET['check_id']); mysql_select_db($database_BE2, $BE2); $Result1= mysql_query($deleteSQL, $BE2) or die(mysql_error()); } $currentPage = "main.php" ;//$_SERVER["PHP_SELF"]; $maxRows_Rt2 = 5; $pageNum_Rt2 = 0; if (isset($_GET['pageNum_Rt2'])) { $pageNum_Rt2 = $_GET['pageNum_Rt2']; } $startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2; mysql_select_db($database_BE2, $BE2); $query_Rt2 = "SELECT a.*,b.webname FROM news as a left join cuser as b on a.cuid1=b.cuid WHERE a.fn<>'C' ORDER BY a.id DESC"; $query_limit_Rt2 = sprintf("%s LIMIT %d, %d", $query_Rt2, $startRow_Rt2, $maxRows_Rt2); $Rt2 = mysql_query($query_limit_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); if (isset($_GET['totalRows_Rt2'])) { $totalRows_Rt2 = $_GET['totalRows_Rt2']; } else { $all_Rt2 = mysql_query($query_Rt2); $totalRows_Rt2 = mysql_num_rows($all_Rt2); } $totalPages_Rt2 = ceil($totalRows_Rt2/$maxRows_Rt2)-1; $queryString_Rt2 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Rt2") == false && stristr($param, "totalRows_Rt2") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Rt2 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Rt2 = sprintf("&totalRows_Rt2=%d%s", $totalRows_Rt2, $queryString_Rt2); ?> <table width="90%" border="0" cellspacing="0" cellpadding="3"> <tr> <td colspan="7" align="center"></td> </tr> <tr> <th width="44%" height="32" align="center" nowrap="nowrap" class="font2">標題</th> <th width="17%" nowrap="nowrap" class="font2">日期</th> <th width="9%" nowrap="nowrap" class="font2">主頁顯示</th> <th width="8%" nowrap="nowrap" class="font2">顯示</th> <th width="9%" nowrap="nowrap" class="font2">已審核</th> <th colspan="2" align="center" nowrap="nowrap" class="font2">修改/刪除</th> </tr> <?php do { ?> <tr> <td align="left" class="font3"><h3><?=$row_Rt2['title'];?></h3></td> <td align="center" class="font3"><?php echo $row_Rt2['idate']; ?></td> <td align="center" class="font3"><img src="images/<?= $row_Rt2['homefn']; ?>.png" border="0" /></td> <td align="center" class="font3"><img src="images/<?= $row_Rt2['fn']; ?>.png" border="0" /></td> <td align="center" class="font3"><img src="images/<?= $row_Rt2['fck']; ?>.png" border="0" /></td> <td width="6%" align="center" class="font3"><a href="main.php?act=ad_newsedit&id=<?php echo $row_Rt2['id']; ?>"><img src="images/edit.png" alt="修改項目名稱" width="16" height="16" border="0" /></a></td> <td width="7%" align="center" class="font3"><a href="javascript:if(confirm('確實要刪除嗎?'))location='<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, $pageNum_Rt2 , $queryString_Rt2)?><? echo "&check_id=".$row_Rt2['id']; ?>'"><img src="images/del.png" alt="刪除項目" width="16" height="16" border="0"/></a></td> </tr> <tr> <td align="left" class="font2"><?=$row_Rt2['doc'];?></td> <td colspan="4" align="right" valign="bottom" class="font2"><font color="#FF0000"><?= $row_Rt2['webname']; ?></font></td> <td width="6%" align="center" class="font2"></td> <td width="7%" align="center" class="font2"></td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr> <td height="40" colspan="10" align="center" ><table width="697" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="34%">總筆數:<?php echo $totalRows_Rt2 ?>筆 </td> <td width="66%"><div id="font_s"> <p> <?php if ($pageNum_Rt2 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, max(0, $pageNum_Rt2 - 1), $queryString_Rt2); ?>"><img src="images/previous.png" alt="上一頁" title="上一頁" width="30" height="11" border="0" /></a> <?php } // Show if not first page ?> 第 <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('self',this,0)"> <? for($i=0;$i<=$totalPages_Rt2;$i++){?> <option value="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, $i, $queryString_Rt2); ?>" <? if($pageNum_Rt2==$i){ ?>selected="selected" <? }?>><? echo $i+1 ;?></option> <? }?> </select> 頁 <?php //分頁程式 if($totalPages_Rt2<9){ $start=0; $end=$totalPages_Rt2; }else{ $start=$pageNum_Rt2-5; $end=$pageNum_Rt2+5; if ($start<0){ $start=0; $end=10; } else { $end=$start+10 ;} if ($end>$totalPages_Rt2){ $start = $end-$totalPages_Rt2-5; $end=$totalPages_Rt2; } if ($end-$start>10){ $start = $end-10; } } for($i=$start;$i<=$end;$i++){ if($i==$pageNum_Rt2){ echo "[".($i+1)."]";} else {?> <a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $i), $queryString_Rt2); ?>"> <? echo $i+1 ;?></a> <? } } ?> <?php if ($pageNum_Rt2 < $totalPages_Rt2) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $pageNum_Rt2 + 1), $queryString_Rt2); ?>"><img src="images/next.png" alt="下一頁" title="下一頁" width="30" height="11" border="0" /></a> <?php } // Show if not last page ?> </p> </div></td> </tr> </table></td> </tr> </table> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表