auto_rules.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. $default_displayed=50;
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  5. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  6. if (isset($_POST["removeRule"])) {
  7. $r_id = $_POST["f_id"];
  8. foreach ($r_id as $key => $val) {
  9. if ($val) { delete_record($db_link, "auth_rules", "id=".$val); }
  10. }
  11. header("Location: " . $_SERVER["REQUEST_URI"]);
  12. exit;
  13. }
  14. print_ip_submenu($page_url);
  15. ?>
  16. <div id="cont">
  17. <br>
  18. <form name="def" action="auto_rules.php" method="post">
  19. <div>
  20. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?> <input type="submit" value="<?php echo WEB_btn_show; ?>">
  21. </div>
  22. <?php
  23. fix_auth_rules($db_link);
  24. $countSQL="SELECT Count(*) FROM auth_rules";
  25. $res = mysqli_query($db_link, $countSQL);
  26. $count_records = mysqli_fetch_array($res);
  27. $total=ceil($count_records[0]/$displayed);
  28. if ($page>$total) { $page=$total; }
  29. if ($page<1) { $page=1; }
  30. $start = ($page * $displayed) - $displayed;
  31. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  32. ?>
  33. <table class="data">
  34. <tr align="center">
  35. <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
  36. <td><b><?php echo WEB_cell_type; ?></b></td>
  37. <td><b><?php echo WEB_ou_rule; ?></b></td>
  38. <td><b><?php echo WEB_rules_target; ?></b></td>
  39. <td align=right><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="removeRule" value="<?php echo WEB_btn_delete; ?>"></td>
  40. </tr>
  41. <?php
  42. $t_auth_rules = get_records_sql($db_link,"SELECT * FROM auth_rules ORDER BY id LIMIT $start,$displayed");
  43. foreach ( $t_auth_rules as $row ) {
  44. print "<tr align=center>\n";
  45. print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value=".$row["id"]." ></td>\n";
  46. print "<td class=\"data\">";
  47. if ($row['type'] == 1) { print "Subnet"; }
  48. if ($row['type'] == 2) { print "Mac"; }
  49. if ($row['type'] == 3) { print "Hostname"; }
  50. print "</td>\n";
  51. print "<td class=\"data\">".$row['rule']."</td>\n";
  52. print "<td colspan=2 class=\"data\" align=left>";
  53. if (!empty($row['user_id'])) {
  54. $user_info=get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$row['user_id']);
  55. if (!empty($user_info)) { print "User: &nbsp"; print_url($user_info['login'],'/admin/users/edituser.php?id='.$user_info['id']); }
  56. }
  57. if (!empty($row['ou_id'])) {
  58. $ou_info=get_record_sql($db_link,"SELECT * FROM OU WHERE id=".$row['ou_id']);
  59. if (!empty($ou_info)) { print "Group: &nbsp"; print_url($ou_info['ou_name'],'/admin/groups/edit_group.php?id='.$ou_info['id']); }
  60. }
  61. print "</td>";
  62. print "</tr>\n";
  63. }
  64. ?>
  65. </table>
  66. </form>
  67. <?php
  68. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  69. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  70. ?>