1
0

mactable.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. $snmp_ok = 0;
  16. if (!empty($device['ip']) and $device['snmp_version'] > 0) {
  17. $snmp_ok = check_snmp_access($device['ip'], $device['community'], $device['snmp_version']);
  18. }
  19. if ($snmp_ok) {
  20. $fdb = get_fdb_table($device['ip'], $device['community'], $device['snmp_version']);
  21. print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
  22. print "<tr>";
  23. print "<td>Port</td>\n";
  24. print "<td>User</td>\n";
  25. print "<td>Mac</td>\n";
  26. print "</tr>";
  27. foreach ($ports as $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. } else {
  40. print "No SNMP access!";
  41. }
  42. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  43. ?>