mactable.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
  5. ?>
  6. <html>
  7. <head>
  8. <title>Панель администратора</title>
  9. <link rel="stylesheet" type="text/css" href="/<?php echo HTML_STYLE.".css"; ?>">
  10. <meta http-equiv="content-type" content="application/xhtml+xml">
  11. <meta charset="UTF-8">
  12. </head>
  13. <body>
  14. <div id="cont">
  15. <?php
  16. $dev = get_record($db_link,'devices',"id=$id");
  17. $ports = get_records($db_link,'device_ports',"device_id=$id AND uplink=0 ORDER BY port");
  18. print "<b>Список маков активных на свиче ".$dev['device_name']." (".$dev['ip']."):</b>\n";
  19. $fdb = get_fdb_table($dev['ip'], $dev['community'], $dev['snmp_version']);
  20. print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
  21. print "<tr>";
  22. print "<td>Port</td>\n";
  23. print "<td>User</td>\n";
  24. print "<td>Mac</td>\n";
  25. print "</tr>";
  26. foreach ($ports as $port) {
  27. if (!$dev['fdb_snmp_index']) { $port['snmp_index'] = $port['port']; }
  28. foreach ($fdb as $a_mac => $a_port) {
  29. if ($a_port == $port['snmp_index']) {
  30. print "<tr>";
  31. print "<td class=\"data\">" . $port['port'] . "</td>\n";
  32. $auth = get_auth_by_mac($db_link, dec_to_hex($a_mac));
  33. print "<td class=\"data\">" .$auth['auth'] . "</td><td class=\"data\">". $auth['mac']."</td>\n";
  34. print "</tr>";
  35. }
  36. }
  37. }
  38. print "</table>\n";
  39. ?>
  40. </body>
  41. </html>