查看文件: market_list.php
大小: 9.01 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if(isset($_GET['del_id']) && ( $_GET['del_id']>0 )){ mysql_select_db($database_BE2, $BE2); $delete_SQL = sprintf("delete from shop5 WHERE smid='%s'",$_GET['del_id']); mysql_query($delete_SQL, $BE2) or die(mysql_error()); mysql_select_db($database_BE2, $BE2); $delete_SQL = sprintf("delete from marketstreet WHERE mid='%s'",$_GET['del_id']); mysql_query($delete_SQL, $BE2) or die(mysql_error()); } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_Rt2 = 12; $pageNum_Rt2 = 0; if (isset($_GET['pageNum_Rt2'])) { $pageNum_Rt2 = $_GET['pageNum_Rt2']; } $startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2; $kid = '-1'; if (isset($_GET['selkid'])) { $kid = $_GET['selkid']; } mysql_select_db($database_BE2, $BE2); $query_Rt1 = "SELECT distinct(mname) FROM marketstreet where 1 " ; $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); if($kid == '-1'){ $kid=$row_Rt1['mname'] ;} mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT * FROM marketstreet where mname='%s' order by mcounty,mind",$kid); $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); $city=$row_Rt2['mcounty']; 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); mysql_select_db($database_BE2, $BE2); $query_Rt3 = sprintf("SELECT * FROM marketmaster where msname='%s' ",$kid); $Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error()); $row_Rt3 = mysql_fetch_assoc($Rt3); $totalRows_Rt3 = mysql_num_rows($Rt3); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <? $ss='<a href="main.php?act=market_qmake&city='.$kid.'">快速建立<a>'; ?> <h3 class="panel-title">街道商圈管理 <font color="#0000FF"><?= $ss ?></font></h3> <div class="panel-options"> <a href="main.php?act=market_add&city=<?=$city?>&mname=<?= $kid; ?>"> <i class="fa-plus"></i> </a> </div> </div> <span class="panel-title">商圈</span>選取 <select name="selkid" id="selkid" onchange="MM_jumpMenu('self',this,0)"> <? do { ?> <option value="<?php printf("%s?act=market_list&selkid=%s", $currentPage, $row_Rt1['mname']); ?>" <? if($row_Rt1['mname']==$kid){ ?>selected="selected" <? }?>><?= $row_Rt1['mname'] ;?></option> <? } while ($row_Rt1 = mysql_fetch_assoc($Rt1)); ?> </select> <div> <? if($totalRows_Rt3==0){?> <a href="<? printf("%s?act=market_master&msid=0&key=%s",$currentPage,$row_Rt2['mname']); ?>"><h3><font color="#FF0000"> 建立主圖</font></h3> </a> <? } else{?> <table cellspacing="1" class="table table-small-font table-bordered table-striped"> <tr> <td width="7"> </td> <td width="108">主<span class="font2">圖示</span></td> <td width="123"><span class="font2">商圈名稱說明</span></td> <td width="455">連結</td> </tr> <tr> <td><a href="main.php?act=market_master&msid=<?php echo $row_Rt3['msid']; ?>"><img src="images/edit.png" alt="修改項目名稱" title="修改項目名稱" width="16" height="16" border="0" /></a></td> <td> <? if($row_Rt3['mspic']<>''){?><img name="" src="/products/<?=$row_Rt3['mspic']?>" width="60" alt="<?= $row_Rt3['msname'] ?>" /><? }?> </td> <td><?= $row_Rt3['msname']; ?></td> <td> <a href="<?= $row_Rt3['mslink']; ?>"><?= $row_Rt3['mslink']; ?></a></td> </tr> </table> <? }?> </div> <table cellspacing="1" class="table table-small-font table-bordered table-striped"> <tr> <th height="25" nowrap="nowrap" class="font2">ID</th> <th nowrap="nowrap" class="font2">城市</th> <th nowrap="nowrap" class="font2">街道區域</th> <th nowrap="nowrap" class="font2">商圈名稱說明</th> <th nowrap="nowrap" class="font2">圖示</th> <th nowrap="nowrap" class="font2">排序</th> <th nowrap="nowrap" class="font2">啟用</th> <th nowrap="nowrap" class="font2">刪除</th> </tr> <?php if($totalRows_Rt2>0){ do { ?> <tr> <td align="center" class="font3"><a href="main.php?act=market_edit&id=<?php echo $row_Rt2['mid']; ?>"><img src="images/edit.png" alt="修改項目名稱" title="修改項目名稱" width="16" height="16" border="0" /></a></td> <td align="center"><span class="font3"> <?= $row_Rt2['mcounty']; ?> </span></td> <td align="left" valign="middle" class="font3"><?= $row_Rt2['maddress_name'].','.$row_Rt2['mside']; ?></td> <td align="center" valign="middle" class="font3"> <a href="/submarket/<?= $row_Rt2['mname'] ?>.html" target="_blank"><?= $row_Rt2['mname'] ?></a></td> <td align="center" valign="middle" class="font3"><? if($row_Rt2['mpic']<>''){?><img name="" src="/submarket/images/<?=$row_Rt2['mpic']?>" width="60" height="60" alt="" /><? }?></td> <td align="center" valign="middle" class="font3"><? echo $row_Rt2['mind']; /* <a href="main.php?act=marketshop_list&mid=<?=$row_Rt2['mid'] ;?>"><img src="images/home.png" width="45" height="45" alt="logo" /></a>*/ ?></td> <td align="center" valign="middle" class="font3"><?= $row_Rt2['mck']; ?></td> <td align="center" valign="middle" class="font3"> <a href="javascript:if(confirm('確實要刪除嗎?'))location='<?= 'main.php?act=market_list&selkid='.$kid.'&del_id='.$row_Rt2['mid'] ;?>'"><img src="images/del.png" alt="刪除項目" width="16" height="16" border="0"/></a> </td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); } ?> <tr> <td colspan="8"> <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/First.gif" alt="上一頁" title="上一頁" width="18" height="13" 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.gif" alt="下一頁" title="下一頁" width="14" height="13" border="0" /></a> <?php } // Show if not last page ?> </p> </div></td> </tr> </table> </td> </tr> </table> </div> </div> </div> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表