2011-04-24 12:55:20 +00:00
< ? php
echo ( '<table border="0" cellspacing="0" cellpadding="5" width="100%">' );
2011-05-14 23:08:16 +00:00
echo ( '<tr><th>Port</th><th>MAC address</th><th>IPv4 address</th><th>Remote device</th><th>Remote port</th></tr>' );
2011-04-24 12:55:20 +00:00
$i = " 1 " ;
2011-05-16 10:56:50 +00:00
foreach ( dbFetchRows ( " SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = ? " , array ( $device [ 'device_id' ])) as $arp )
2011-04-24 12:55:20 +00:00
{
if ( ! is_integer ( $i / 2 )) { $bg_colour = $list_colour_a ; } else { $bg_colour = $list_colour_b ; }
2011-05-16 10:56:50 +00:00
$arp_host = dbFetchRow ( " SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.interface_id = A.interface_id AND D.device_id = I.device_id " , array ( $arp [ 'ipv4_address' ]));
2011-04-24 12:55:20 +00:00
if ( $arp_host ) { $arp_name = generate_device_link ( $arp_host ); } else { unset ( $arp_name ); }
if ( $arp_host ) { $arp_if = generate_port_link ( $arp_host ); } else { unset ( $arp_if ); }
if ( $arp_host [ 'device_id' ] == $device [ 'device_id' ]) { $arp_name = " Localhost " ; }
if ( $arp_host [ 'interface_id' ] == $arp [ 'interface_id' ]) { $arp_if = " Local Port " ; }
echo ( "
< tr bgcolor = $bg_colour >
< td width = 200 >< b > " .generate_port_link(array_merge( $arp , $device )). " </ b ></ td >
< td width = 160 > " .formatmac( $arp['mac_address'] ). " </ td >
2011-05-14 23:08:16 +00:00
< td width = 160 > " . $arp['ipv4_address'] . " </ td >
< td width = 280 > $arp_name </ td >
2011-04-24 12:55:20 +00:00
< td > $arp_if </ td >
</ tr > " );
$i ++ ;
}
echo ( " </table> " );
?>