1
0

control-subnets-usage.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. <b><?php echo WEB_network_usage_title; ?></b> <br>
  12. <table class="data">
  13. <tr align="center">
  14. <td><b><?php echo WEB_network_subnet; ?></b></td>
  15. <td><b><?php echo WEB_network_all_ip; ?></b></td>
  16. <td><b><?php echo WEB_network_used_ip; ?></b></td>
  17. <td><b><?php echo WEB_network_free_ip; ?></b></td>
  18. <td><b><?php echo WEB_network_dhcp_size; ?></b></td>
  19. <td><b><?php echo WEB_network_dhcp_used; ?></b></td>
  20. <td><b><?php echo WEB_network_dhcp_free; ?></b></td>
  21. <td><b><?php echo WEB_network_static_free; ?></b></td>
  22. <td><b><?php echo WEB_network_zombi; ?><br><?php print "(> ".$zombi_days." ".WEB_days.")"; ?></b></td>
  23. <td><b><?php echo WEB_network_zombi_dhcp; ?><br><?php print "(> ".$zombi_days." ".WEB_days.")"; ?></b></td>
  24. </tr>
  25. <?php
  26. $t_subnets = get_records($db_link,'subnets','office=1 ORDER BY ip_int_start');
  27. if (!empty($t_subnets)) {
  28. foreach ( $t_subnets as $row ) {
  29. print "<tr align=center>\n";
  30. $cl="data";
  31. print "<td class=\"$cl\"><a href=/admin/iplist/index.php?ou=0&cidr=".$row['subnet'].">".$row['subnet']."</a></td>\n";
  32. $all_ips = $row['ip_int_stop']-$row['ip_int_start']-3;
  33. print "<td class=\"$cl\">".$all_ips."</td>\n";
  34. #used
  35. $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']);
  36. print "<td class=\"$cl\">".$used_all."</td>\n";
  37. $free_all = $all_ips - $used_all;
  38. print "<td class=\"$cl\">".$free_all."</td>\n";
  39. $dhcp_pool = $row['dhcp_stop']-$row['dhcp_start']+1;
  40. print "<td class=\"$cl\">".$dhcp_pool."</td>\n";
  41. #used pool
  42. $used_dhcp = get_count_records($db_link,'User_auth','deleted=0 and ip_int>='.$row['dhcp_start'].' and ip_int<='.$row['dhcp_stop']);
  43. print "<td class=\"$cl\">".$used_dhcp."</td>\n";
  44. $free_dhcp = $dhcp_pool - $used_dhcp;
  45. print "<td class=\"$cl\">".$free_dhcp."</td>\n";
  46. $free_static = $free_all - $free_dhcp;
  47. print "<td class=\"$cl\">".$free_static."</td>\n";
  48. $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)');
  49. print "<td class=\"$cl\">".$zombi."</td>\n";
  50. $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)');
  51. print "<td class=\"$cl\">".$zombi."</td>\n";
  52. print "</tr>\n";
  53. }
  54. }
  55. ?>
  56. </table>
  57. <?php require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php"); ?>