1
0

deleted.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. $default_displayed = 500;
  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. $default_sort='ip_int';
  7. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oufilter.php");
  8. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/subnetfilter.php");
  9. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sortfilter.php");
  10. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/gatefilter.php");
  11. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/enabledfilter.php");
  12. if (isset($_POST['searchComment'])) { $f_comment = $_POST['searchComment']; }
  13. if (isset($_GET['searchComment'])) { $f_comment = $_GET['searchComment']; }
  14. if (!isset($f_comment) and isset($_SESSION[$page_url]['comment'])) { $f_comment=$_SESSION[$page_url]['comment']; }
  15. if (!isset($f_comment)) { $f_comment=''; }
  16. $_SESSION[$page_url]['comment']=$f_comment;
  17. $sort_table = 'User_auth';
  18. $sort_url = "<a href=deleted.php?";
  19. if ($rsubnet == 0) { $subnet_filter = ''; } else {
  20. $subnet_range = get_subnet_range($db_link,$rsubnet);
  21. $subnet_filter = " and User_auth.ip_int>=".$subnet_range['start']." and User_auth.ip_int<=".$subnet_range['stop'];
  22. }
  23. $ip_list_filter = $subnet_filter;
  24. $ip_where = '';
  25. if (!empty($f_comment)) {
  26. if (checkValidIp($f_comment)) { $ip_where = " and ip_int=inet_aton('" . $f_comment . "') "; }
  27. if (checkValidMac($f_comment)) { $ip_where = " and mac='" . mac_dotted($f_comment) . "' "; }
  28. if (empty($ip_where)) { $ip_where=" and (User_auth.comments LIKE '$f_comment' OR User_auth.dhcp_hostname LIKE '$f_comment')"; }
  29. $ip_list_filter = $ip_where;
  30. }
  31. print_ip_submenu($page_url);
  32. ?>
  33. <div id="cont">
  34. <form name="def" action="deleted.php" method="post">
  35. <br>
  36. <div>
  37. <b><?php print WEB_network_subnet; ?> - </b><?php print_subnet_select_office($db_link, 'subnet', $rsubnet); ?>
  38. <?php echo WEB_ips_search_full; ?>: &nbsp <input type=text name=searchComment value="<?php print $f_comment; ?>">
  39. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
  40. <input type="submit" value="<?php echo WEB_btn_show; ?>">
  41. </div>
  42. <?php
  43. $countSQL="SELECT Count(*) FROM User_auth WHERE User_auth.deleted = 1 $ip_list_filter";
  44. $res = mysqli_query($db_link, $countSQL);
  45. $count_records = mysqli_fetch_array($res);
  46. $total=ceil($count_records[0]/$displayed);
  47. if ($page>$total) { $page=$total; }
  48. if ($page<1) { $page=1; }
  49. $start = ($page * $displayed) - $displayed;
  50. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  51. ?>
  52. <br>
  53. <table class="data">
  54. <tr>
  55. <td align=Center><?php print $sort_url . "sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
  56. <td align=Center><?php print $sort_url . "sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
  57. <td align=Center><?php print WEB_cell_comment; ?></td>
  58. <td align=Center><?php print WEB_cell_dns_name; ?></td>
  59. <td align=Center><?php print $sort_url . "sort=timestamp&order=$new_order>".WEB_cell_created."</a>"; ?></td>
  60. <td align=Center><?php print $sort_url . "sort=changed_time&order=$new_order>".WEB_cell_deleted."</a>"; ?></td>
  61. <td align=Center><?php print $sort_url . "sort=last_found&order=$new_order>".WEB_cell_last_found."</a>"; ?></td>
  62. </tr>
  63. <?php
  64. $sSQL = "SELECT
  65. User_auth.id, User_auth.ip, User_auth.mac, User_auth.comments, User_auth.dns_name, User_auth.dhcp_hostname,
  66. User_auth.dhcp_time, User_auth.last_found, User_auth.timestamp, User_auth.changed_time
  67. FROM User_auth WHERE User_auth.deleted = 1 $ip_list_filter
  68. ORDER BY $sort_table.$sort_field $order LIMIT $start,$displayed";
  69. $users = get_records_sql($db_link,$sSQL);
  70. foreach ($users as $user) {
  71. if (empty($user['last_found']) or $user['last_found'] === '0000-00-00 00:00:00') { $user['last_found'] = ''; }
  72. if (empty($user['timestamp']) or $user['timestamp'] === '0000-00-00 00:00:00') { $user['timestamp'] = ''; }
  73. if (empty($user['changed_time']) or $user['changed_time'] === '0000-00-00 00:00:00') { $user['changed_time'] = ''; }
  74. print "<tr align=center>\n";
  75. $cl = "data";
  76. print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
  77. print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
  78. if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
  79. print "<td class=\"$cl\" >".$user['comments']." [" . $user['dhcp_hostname'] . "]</td>\n";
  80. } else {
  81. print "<td class=\"$cl\" >".$user['comments']."</td>\n";
  82. }
  83. print "<td class=\"$cl\" >".$user['dns_name']."</td>\n";
  84. print "<td class=\"$cl\" >".$user['timestamp']."</td>\n";
  85. print "<td class=\"$cl\" >".$user['changed_time']."</td>\n";
  86. print "<td class=\"$cl\" >".$user['last_found']."</td>\n";
  87. print "</tr>\n";
  88. }
  89. print "</table>\n";
  90. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  91. ?>
  92. <?php
  93. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  94. ?>