deleted.php 5.0 KB

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