deleted.php 4.9 KB

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