1
0

control-subnets-usage.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. unset($_POST);
  5. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  6. print_control_submenu($page_url);
  7. $zombi_days = get_option($db_link, 35);
  8. ?>
  9. <div id="cont">
  10. <br>
  11. <form name="def" action="control-subnets.php" method="post">
  12. <b><?php echo WEB_network_usage_title; ?></b> <br>
  13. <table class="data">
  14. <tr align="center">
  15. <td><b><?php echo WEB_network_subnet; ?></b></td>
  16. <td><b><?php echo WEB_network_all_ip; ?></b></td>
  17. <td><b><?php echo WEB_network_used_ip; ?></b></td>
  18. <td><b><?php echo WEB_network_free_ip; ?></b></td>
  19. <td><b><?php echo WEB_network_dhcp_size; ?></b></td>
  20. <td><b><?php echo WEB_network_dhcp_used; ?></b></td>
  21. <td><b><?php echo WEB_network_dhcp_free; ?></b></td>
  22. <td><b><?php echo WEB_network_static_free; ?></b></td>
  23. <td><b><?php echo WEB_network_zombi; ?><br><?php print "(> ".$zombi_days." ".WEB_days.")"; ?></b></td>
  24. <td><b><?php echo WEB_network_zombi_dhcp; ?><br><?php print "(> ".$zombi_days." ".WEB_days.")"; ?></b></td>
  25. </tr>
  26. <?php
  27. $t_subnets = get_records($db_link,'subnets','office=1 ORDER BY ip_int_start');
  28. if (!empty($t_subnets)) {
  29. foreach ( $t_subnets as $row ) {
  30. print "<tr align=center>\n";
  31. $cl="data";
  32. print "<td class=\"$cl\"><a href=/admin/iplist/index.php?ou=0&subnet=".$row['id'].">".$row['subnet']."</a></td>\n";
  33. $all_ips = $row['ip_int_stop']-$row['ip_int_start']-3;
  34. print "<td class=\"$cl\">".$all_ips."</td>\n";
  35. #used
  36. $used_all = get_count_records($db_link,'User_auth','deleted=0 and ip_int>='.$row['ip_int_start'].' and ip_int<='.$row['ip_int_stop']);
  37. print "<td class=\"$cl\">".$used_all."</td>\n";
  38. $free_all = $all_ips - $used_all;
  39. print "<td class=\"$cl\">".$free_all."</td>\n";
  40. $dhcp_pool = $row['dhcp_stop']-$row['dhcp_start']+1;
  41. print "<td class=\"$cl\">".$dhcp_pool."</td>\n";
  42. #used pool
  43. $used_dhcp = get_count_records($db_link,'User_auth','deleted=0 and ip_int>='.$row['dhcp_start'].' and ip_int<='.$row['dhcp_stop']);
  44. print "<td class=\"$cl\">".$used_dhcp."</td>\n";
  45. $free_dhcp = $dhcp_pool - $used_dhcp;
  46. print "<td class=\"$cl\">".$free_dhcp."</td>\n";
  47. $free_static = $free_all - $free_dhcp;
  48. print "<td class=\"$cl\">".$free_static."</td>\n";
  49. $zombi = get_count_records($db_link,'User_auth','deleted=0 and ip_int>='.$row['ip_int_start'].' and ip_int<='.$row['ip_int_stop'].' and last_found<=(NOW() - INTERVAL '.$zombi_days.' DAY)');
  50. print "<td class=\"$cl\">".$zombi."</td>\n";
  51. $zombi = get_count_records($db_link,'User_auth','deleted=0 and ip_int>='.$row['dhcp_start'].' and ip_int<='.$row['dhcp_stop'].' and last_found<=(NOW() - INTERVAL '.$zombi_days.' DAY)');
  52. print "<td class=\"$cl\">".$zombi."</td>\n";
  53. print "</tr>\n";
  54. }
  55. }
  56. ?>
  57. </table>
  58. </form>
  59. <?php require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php"); ?>