sort.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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_field" id="search-field" value="title">
  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="title">标题</a> </li>
  22. <li> <a tabindex="-1" href="javascript:void(0)" data-field="cat_name">栏目</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="addSort.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/doSort.php">
  35. <table class="table table-bordered">
  36. <thead>
  37. <tr>
  38. <th>编号</th>
  39. <th>名称</th>
  40. <th>别名</th>
  41. <th>序号</th>
  42. <th>操作</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <?php
  47. include_once("../untils/conn.php");
  48. mysqli_query($con, "set names utf8");
  49. $yysname = $_GET['yys'];
  50. if ($con) {
  51. //选择数据库
  52. if ($db) {
  53. $id = $_GET['id'];
  54. //获取数据总行数
  55. $sql = "select * from list where yys='$yysname' ORDER BY xuhao DESC";
  56. $sortsql = "select * from sort";
  57. $data = mysqli_query($con, $sql);
  58. $sortdata = mysqli_query($con, $sortsql);
  59. ?>
  60. <?php
  61. while ($sortrow = mysqli_fetch_array($sortdata)) {
  62. ?>
  63. <tr>
  64. <td><?php echo $sortrow["id"] ?></td>
  65. <td><?php echo $sortrow["yys"] ?></td>
  66. <td><?php echo $sortrow["yysabbr"] ?></td>
  67. <td><?php echo $sortrow["sortid"] ?></td>
  68. <td>
  69. <a class="btn btn-success btn-sm" href=upSort.php?id=<?php echo $sortrow['id'] ?>>修改</a>
  70. <a class="btn btn-danger btn-sm" href="controller/deSort.php?id=<?php echo $sortrow['id'] ?>" onclick=" return del()">删除</a>
  71. </td>
  72. </tr>
  73. <?php
  74. }
  75. ?>
  76. <?php
  77. }
  78. }
  79. ?>
  80. </tbody>
  81. </table>
  82. </form>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <script language="javascript">
  89. //删除弹出确认框
  90. function del() {
  91. if (confirm("确认删除吗?")) {
  92. return true;
  93. } else {
  94. return false;
  95. }
  96. }
  97. function chek() {
  98. var leng = this.form1.chk.length;
  99. if (leng == undefined) {
  100. leng = 1;
  101. if (!form1.chk.checked)
  102. document.chk.checked = true;
  103. else
  104. document.form1.chk.checked = false;
  105. } else {
  106. for (var i = 0; i < leng; i++) {
  107. if (!form1.chk[i].checked)
  108. document.form1.chk[i].checked = true;
  109. else
  110. document.form1.chk[i].checked = false;
  111. }
  112. }
  113. return false;
  114. }
  115. </script>
  116. </div>
  117. </main>
  118. <!--End 页面主要内容-->
  119. <?php require_once('common/footer.php'); ?>
  120. <?php
  121. } else {
  122. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  123. }
  124. ?>