deleted.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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['searchDescription'])) { $f_description = $_POST['searchDescription']; }
  13. if (isset($_GET['searchDescription'])) { $f_description = $_GET['searchDescription']; }
  14. if (!isset($f_description) and isset($_SESSION[$page_url]['description'])) { $f_description=$_SESSION[$page_url]['description']; }
  15. if (!isset($f_description)) { $f_description=''; }
  16. $_SESSION[$page_url]['description']=$f_description;
  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_description)) {
  26. if (checkValidIp($f_description)) { $ip_where = " and ip_int=inet_aton('" . $f_description . "') "; }
  27. if (checkValidMac($f_description)) { $ip_where = " and mac='" . mac_dotted($f_description) . "' "; }
  28. if (empty($ip_where)) { $ip_where=" and (user_auth.description LIKE '$f_description' OR user_auth.dhcp_hostname LIKE '$f_description')"; }
  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=searchDescription value="<?php print $f_description; ?>">
  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. $count_records = get_single_field($db_link,$countSQL);
  45. $total=ceil($count_records/$displayed);
  46. if ($page>$total) { $page=$total; }
  47. if ($page<1) { $page=1; }
  48. $start = ($page * $displayed) - $displayed;
  49. print_navigation($page_url,$page,$displayed,$count_records,$total);
  50. ?>
  51. <br>
  52. <table class="data">
  53. <tr>
  54. <td align=Center><?php print $sort_url . "sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
  55. <td align=Center><?php print $sort_url . "sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
  56. <td align=Center><?php print WEB_cell_description; ?></td>
  57. <td align=Center><?php print WEB_cell_dns_name; ?></td>
  58. <td align=Center><?php print $sort_url . "sort=ts&order=$new_order>".WEB_cell_created."</a>"; ?></td>
  59. <td align=Center><?php print $sort_url . "sort=changed_time&order=$new_order>".WEB_cell_deleted."</a>"; ?></td>
  60. <td align=Center><?php print $sort_url . "sort=last_found&order=$new_order>".WEB_cell_last_found."</a>"; ?></td>
  61. </tr>
  62. <?php
  63. $sSQL = "SELECT
  64. user_auth.id, user_auth.ip, user_auth.mac, user_auth.description, user_auth.dns_name, user_auth.dhcp_hostname,
  65. user_auth.dhcp_time, user_auth.last_found, user_auth.ts, user_auth.changed_time
  66. FROM user_auth WHERE user_auth.deleted = 1 $ip_list_filter
  67. ORDER BY $sort_table.$sort_field $order LIMIT $displayed OFFSET $start";
  68. $users = get_records_sql($db_link,$sSQL);
  69. foreach ($users as $user) {
  70. if (empty($user['last_found']) or $user['last_found'] === '0000-00-00 00:00:00') { $user['last_found'] = ''; }
  71. if (empty($user['ts']) or $user['ts'] === '0000-00-00 00:00:00') { $user['ts'] = ''; }
  72. if (empty($user['changed_time']) or $user['changed_time'] === '0000-00-00 00:00:00') { $user['changed_time'] = ''; }
  73. print "<tr align=center>\n";
  74. $cl = "data";
  75. print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
  76. print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
  77. if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
  78. print "<td class=\"$cl\" >".$user['description']." [" . $user['dhcp_hostname'] . "]</td>\n";
  79. } else {
  80. print "<td class=\"$cl\" >".$user['description']."</td>\n";
  81. }
  82. print "<td class=\"$cl\" >".$user['dns_name']."</td>\n";
  83. print "<td class=\"$cl\" >".$user['ts']."</td>\n";
  84. print "<td class=\"$cl\" >".$user['changed_time']."</td>\n";
  85. print "<td class=\"$cl\" >".$user['last_found']."</td>\n";
  86. print "</tr>\n";
  87. }
  88. print "</table>\n";
  89. print_navigation($page_url,$page,$displayed,$count_records,$total);
  90. ?>
  91. <?php
  92. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  93. ?>