list.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?php
  2. session_start();
  3. if (isset($_SESSION["username"])) {
  4. ?>
  5. <?php require_once('common/header.php'); ?>
  6. <!--页面主要内容-->
  7. <main class="lyear-layout-content">
  8. <div class="container-fluid">
  9. <div class="row">
  10. <div class="col-lg-12">
  11. <div class="card">
  12. <div class="card-toolbar clearfix">
  13. <form class="pull-right search-bar" method="get" action="" role="form">
  14. <div class="input-group">
  15. <div class="input-group-btn">
  16. <input type="hidden" name="search" id="search" value="name">
  17. <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
  18. 产品名称 <span class="caret"></span>
  19. </button>
  20. <ul class="dropdown-menu">
  21. <li> <a tabindex="-1" href="javascript:void(0)" data-field="name">产品名称</a> </li>
  22. <li> <a tabindex="-1" href="javascript:void(0)" data-field="gsd">归属地</a> </li>
  23. </ul>
  24. </div>
  25. <input type="text" class="form-control" value="" name="keyword" placeholder="请输入查询信息">
  26. </div>
  27. </form>
  28. <div class="toolbar-btn-action">
  29. <a class="btn btn-primary m-r-5" href="add.php"><i class="mdi mdi-plus"></i> 新增产品</a>
  30. </div>
  31. </div>
  32. <div class="card-body">
  33. <div class="table-responsive">
  34. <form name="form1" id="form1" method="post" action="controller/deleteall.php">
  35. <table class="table table-bordered">
  36. <?php
  37. include_once("../untils/conn.php");
  38. mysqli_query($con, "set names utf8");
  39. if ($con) {
  40. if ($db) {
  41. // 获取搜索关键词和字段
  42. $keyword = $_GET['keyword'];
  43. $field = $_GET['search'];
  44. // 构建查询语句
  45. $sql = "SELECT * FROM list";
  46. if ($keyword != "") {
  47. $sql .= " WHERE $field LIKE '%$keyword%'";
  48. }
  49. // 获取数据总行数
  50. $data = mysqli_query($con, $sql);
  51. $maxrows = mysqli_num_rows($data);
  52. // 计算总页数
  53. $page_size = 10; // 每页显示数
  54. if ($maxrows % $page_size == 0) {
  55. $maxpage = (int)($maxrows / $page_size);
  56. } else {
  57. $maxpage = (int)($maxrows / $page_size) + 1;
  58. }
  59. // 获取当前页
  60. if (isset($_GET['curpage'])) {
  61. $page = $_GET['curpage'];
  62. } else {
  63. $page = 1;
  64. }
  65. // 分段取出数据
  66. $start = $page_size * ($page - 1);
  67. $get_sql = "$sql ORDER BY state ASC, id DESC LIMIT $start, $page_size";
  68. // 获取数据显示
  69. $data = mysqli_query($con, $get_sql);
  70. ?>
  71. <thead>
  72. <tr>
  73. <th>ID</th>
  74. <th>三方ID</th>
  75. <th>名称</th>
  76. <th>介绍</th>
  77. <th>主图</th>
  78. <th>运营商</th>
  79. <th>时长</th>
  80. <th>包邮</th>
  81. <th>归属地</th>
  82. <th>平台佣金</th>
  83. <th>代理佣金</th>
  84. <th>说明</th>
  85. <th>操作</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <?php
  90. while ($row = mysqli_fetch_array($data)) {
  91. ?>
  92. <tr>
  93. <td style="width:1%;">
  94. <?php echo $row["id"] ?>
  95. </td>
  96. <td style="width:5%;">
  97. <?php echo $row["haokaid"] ?>
  98. </td>
  99. <td style="width:5%;"><?php echo $row["name"] ?>
  100. </td>
  101. <td style="width:10%;"><?php echo $row["jieshao"] ?>
  102. </td>
  103. <td style="width:5%;"><img src="<?php echo $row["zhutu"] ?>" alt="" style="width:60px;">
  104. </td>
  105. <td style="width:5%;"><?php echo $row["yys"] ?>
  106. </td>
  107. <td style="width:5%;"><?php echo $row["ltime"] ?>
  108. </td>
  109. <td style="width:5%;"><?php echo $row["baoyou"] ?>
  110. </td>
  111. <td style="width:5%;"><?php echo $row["gsd"] ?>
  112. </td>
  113. <td style="width:5%;"><?php echo $row["price"] ?>
  114. </td>
  115. <td style="width:5%;"><?php echo $row["proxy_price"] ?>
  116. </td>
  117. <td style="width:10%;"><?php echo $row["notes"] ?>
  118. </td>
  119. <td style="width:15%;">
  120. <a href="../link.php?id=<?php echo $row['id'] ?>" class="btn btn-primary btn-sm" target="_blank">下单链接</a>
  121. <a href="update.php?id=<?php echo $row['id'] ?>" class="btn btn-success btn-sm">修改</a>
  122. <a href="controller/shangjia.php?id=<?php echo $row['id'] ?>" class="btn btn-<?php echo ($row['state'] == 0) ? 'warning' : 'info' ?> btn-sm">
  123. <?php echo ($row['state'] == 0) ? '下架' : '上架' ?>
  124. </a>
  125. <a href="jrChannel.php?id=<?php echo $row['id'] ?>" onclick=" return del()" class="btn btn-info btn-sm">加入渠道</a>
  126. <a href="controller/delete.php?id=<?php echo $row['id'] ?>" onclick=" return del()" class="btn btn-danger btn-sm">删除</a>
  127. </td>
  128. </tr>
  129. <?php
  130. }
  131. ?>
  132. </tbody>
  133. <tfoot>
  134. <tr>
  135. <td colspan="12" style="text-align: right;">
  136. <?php
  137. echo "<p>共 $maxpage 页&nbsp;&nbsp;";
  138. echo "每页 $page_size 项&nbsp;&nbsp;";
  139. //设置上一页
  140. if ($page > 1) {
  141. $prepage = $page - 1;
  142. echo "<a href='?curpage=$prepage'>上一页</a>&nbsp;&nbsp;";
  143. }
  144. //设置下一页
  145. if ($page < $maxpage) {
  146. $nextpage = $page + 1;
  147. echo "<a href='?curpage=$nextpage'>下一页</a>&nbsp;&nbsp;";
  148. }
  149. echo "&nbsp;&nbsp;第 $page 页</p>";
  150. }
  151. }
  152. ?>
  153. </td>
  154. </tr>
  155. </tfoot>
  156. </table>
  157. </form>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. </main>
  166. <script src="../merchant/assets/js/jquery.min.js"></script>
  167. <script>
  168. $(document).ready(function() {
  169. $('.dropdown-menu a').click(function(e) {
  170. e.preventDefault();
  171. var field = $(this).data('field');
  172. var buttonText = $(this).text();
  173. $('#search').val(field);
  174. $('#search-btn').html(buttonText + ' <span class="caret"></span>');
  175. });
  176. });
  177. </script>
  178. <!--End 页面主要内容-->
  179. <?php require_once('common/footer.php'); ?>
  180. <?php
  181. } else {
  182. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  183. }