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. $device=get_record($db_link,'devices',"id=".$id);
  6. $user_info = get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$device['user_id']);
  7. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  8. print_device_submenu($page_url);
  9. print_editdevice_submenu($page_url,$id,$device['device_type'],$user_info['login']);
  10. ?>
  11. <div id="contsubmenu">
  12. <?php
  13. $ports = get_records($db_link,'device_ports',"device_id=$id AND uplink=0 ORDER BY port");
  14. print "<b>".WEB_device_mac_table_show."&nbsp".$device['device_name']." (".$device['ip']."):</b>\n";
  15. $fdb = get_fdb_table($device['ip'], $device['community'], $device['snmp_version']);
  16. print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
  17. print "<tr>";
  18. print "<td>Port</td>\n";
  19. print "<td>User</td>\n";
  20. print "<td>Mac</td>\n";
  21. print "</tr>";
  22. foreach ($ports as $port) {
  23. if (!$device['fdb_snmp_index']) { $port['snmp_index'] = $port['port']; }
  24. foreach ($fdb as $a_mac => $a_port) {
  25. if ($a_port == $port['snmp_index']) {
  26. print "<tr>";
  27. print "<td class=\"data\">" . $port['port'] . "</td>\n";
  28. $auth = get_auth_by_mac($db_link, dec_to_hex($a_mac));
  29. print "<td class=\"data\">" .$auth['auth'] . "</td><td class=\"data\">". $auth['mac']."</td>\n";
  30. print "</tr>";
  31. }
  32. }
  33. }
  34. print "</table>\n";
  35. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  36. ?>