channellist.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. <div class="toolbar-btn-action">
  14. <a class="btn btn-primary m-r-5" href="add.php"><i class="mdi mdi-plus"></i> 新增产品</a>
  15. </div>
  16. </div>
  17. <div class="card-body">
  18. <div class="table-responsive">
  19. <form name="form1" id="form1" method="post" action="controller/deleteall.php">
  20. <table class="table table-bordered">
  21. <?php
  22. include_once("../untils/conn.php");
  23. mysqli_query($con, "set names utf8");
  24. if ($con) {
  25. if ($db) {
  26. //获取数据总行数
  27. $channel_id = $_GET['channel_id'];
  28. $sql = "SELECT * FROM list WHERE channel = '$channel_id' OR channel_one = '$channel_id' OR channel_two = '$channel_id'";
  29. $data = mysqli_query($con, $sql);
  30. $maxrows = mysqli_num_rows($data);
  31. //计算总页数
  32. $page_size = 10; //每页显示数
  33. if ($maxrows % $page_size == 0) {
  34. $maxpage = (int)($maxrows / $page_size);
  35. } else {
  36. $maxpage = (int)($maxrows / $page_size) + 1;
  37. }
  38. //获取当前页
  39. if (isset($_GET['curpage'])) {
  40. $page = $_GET['curpage'];
  41. } else {
  42. $page = 1;
  43. }
  44. //分段取出数据
  45. $start = $page_size * ($page - 1);
  46. $get_sql = "SELECT * FROM list WHERE channel = '$channel_id' OR channel_one = '$channel_id' OR channel_two = '$channel_id' limit $start,$page_size";
  47. //得到数据显示
  48. $data = mysqli_query($con, $get_sql);
  49. ?>
  50. <thead>
  51. <tr>
  52. <th>ID</th>
  53. <th>172ID</th>
  54. <th>名称</th>
  55. <th>介绍</th>
  56. <th>主图</th>
  57. <th>运营商</th>
  58. <th>时长</th>
  59. <th>包邮</th>
  60. <th>归属地</th>
  61. <th>排序</th>
  62. <th>操作</th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <?php
  67. while ($row = mysqli_fetch_array($data)) {
  68. ?>
  69. <tr>
  70. <td style="width:5%;">
  71. <?php echo $row["id"] ?>
  72. </td>
  73. <td style="width:5%;">
  74. <?php echo $row["haokaid"] ?>
  75. </td>
  76. <td style="width:10%;"><?php echo $row["name"] ?>
  77. </td>
  78. <td style="width:10%;"><?php echo $row["jieshao"] ?>
  79. </td>
  80. <td style="width:10%;"><img src="<?php echo $row["zhutu"] ?>" alt="" style="width:60px;">
  81. </td>
  82. <td style="width:10%;"><?php echo $row["yys"] ?>
  83. </td>
  84. <td style="width:10%;"><?php echo $row["ltime"] ?>
  85. </td>
  86. <td style="width:10%;"><?php echo $row["baoyou"] ?>
  87. </td>
  88. <td style="width:7.5%;"><?php echo $row["gsd"] ?>
  89. </td>
  90. <td style="width:7.5%;"><?php echo $row["xuhao"] ?>
  91. </td>
  92. <td style="width:15%;">
  93. <a href="../links.php?id=<?php echo $row['id'] ?>&channel_id=<?php echo $channel_id ?>" class="btn btn-primary btn-sm" target="_blank">下单链接</a>
  94. <a href="controller/deletelist.php?channel_id=<?php echo $channel_id ?>" onclick=" return del()" class="btn btn-danger btn-sm">移除商品</a>
  95. </td>
  96. </tr>
  97. <?php
  98. }
  99. ?>
  100. </tbody>
  101. <tfoot>
  102. <tr>
  103. <td colspan="12" style="text-align: right;">
  104. <?php
  105. echo "<p>共 $maxpage 页&nbsp;&nbsp;";
  106. echo "每页 $page_size 项&nbsp;&nbsp;";
  107. //设置上一页
  108. if ($page > 1) {
  109. $prepage = $page - 1;
  110. echo "<a href='?curpage=$prepage'>上一页</a>&nbsp;&nbsp;";
  111. }
  112. //设置下一页
  113. if ($page < $maxpage) {
  114. $nextpage = $page + 1;
  115. echo "<a href='?curpage=$nextpage'>下一页</a>&nbsp;&nbsp;";
  116. }
  117. echo "&nbsp;&nbsp;第 $page 页</p>";
  118. }
  119. }
  120. ?>
  121. </td>
  122. </tr>
  123. </tfoot>
  124. </table>
  125. </form>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </main>
  134. <!--End 页面主要内容-->
  135. <?php require_once('common/footer.php'); ?>
  136. <?php
  137. } else {
  138. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  139. }