PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/site/dashboard/statistics.php

https://bitbucket.org/bertramtruong/phpipam
PHP | 63 lines | 41 code | 15 blank | 7 comment | 3 complexity | 7de4fc3cbed17f40ac956aa89c799b34 MD5 | raw file
  1. <?php
  2. /*
  3. * Script to print some stats on home page....
  4. *********************************************/
  5. /* get number of sections */
  6. $sectionNum = sizeof(fetchSections ());
  7. /* get number of subnets */
  8. $subnetNum = sizeof(fetchAllSubnets ());
  9. /* get number of IP addresses, split IPv4 / IPv6 */
  10. $ipAddresses = fetchAllIPAddresses ();
  11. $ipCount = sizeof($ipAddresses);
  12. $IPv4Count = 0;
  13. $IPv6Count = 0;
  14. foreach ($ipAddresses as $ipAddress) {
  15. if ($ipAddress['ip_addr'] < 4294967295 ) { $IPv4Count++; }
  16. else { $IPv6Count++; }
  17. }
  18. /* get All users */
  19. $userCount = sizeof(getAllUsers());
  20. ?>
  21. <!-- stats table -->
  22. <table class="table table-striped table-condensed table-hover">
  23. <!-- sections -->
  24. <tr>
  25. <td class="title">Number of Sections</td>
  26. <td><?php print $sectionNum; ?></td>
  27. </tr>
  28. <!-- subnets -->
  29. <tr>
  30. <td class="title">Number of Subnets</td>
  31. <td><?php print $subnetNum; ?></td>
  32. </tr>
  33. <!-- IPv4 addresses -->
  34. <tr>
  35. <td class="title">Number of IPv4 addresses</td>
  36. <td><?php print $IPv4Count; ?></td>
  37. </tr>
  38. <!-- IPv6 addresses -->
  39. <tr>
  40. <td class="title">Number of IPv6 addresses</td>
  41. <td><?php print $IPv6Count; ?></td>
  42. </tr>
  43. <!-- All users - only for admin! -->
  44. <tr>
  45. <td class="title">Number of users</td>
  46. <td><?php print $userCount; ?></td>
  47. </tr>
  48. </table>