2009-12-27 07:58:09 +00:00
< ? php
2009-11-19 19:16:01 +00:00
2015-07-10 13:36:21 +02:00
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">' ;
$i = '1' ;
2009-11-19 19:16:01 +00:00
2015-07-10 13:36:21 +02:00
foreach ( dbFetchRows ( 'SELECT * FROM ipv4_mac WHERE port_id = ?' , array ( $port [ 'port_id' ])) as $arp ) {
if ( ! is_integer ( $i / 2 )) {
$bg_colour = $list_colour_a ;
}
else {
$bg_colour = $list_colour_b ;
}
2009-11-19 19:16:01 +00:00
2015-07-10 13:36:21 +02:00
$arp_host = dbFetchRow ( 'SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id' , array ( $arp [ 'ipv4_address' ]));
2009-11-19 19:16:01 +00:00
2015-07-10 13:36:21 +02:00
if ( $arp_host ) {
$arp_name = generate_device_link ( $arp_host );
}
else {
unset ( $arp_name );
}
2009-11-19 19:16:01 +00:00
2015-07-10 13:36:21 +02:00
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 [ 'port_id' ] == $arp [ 'port_id' ]) {
$arp_if = 'Local Port' ;
}
echo '
< tr bgcolor = " '. $bg_colour .' " >
2010-01-14 00:07:46 +00:00
< td width = " 160 " > '.formatmac($arp[' mac_address ']).' </ td >
< td width = " 140 " > '.$arp[' ipv4_address '].' </ td >
2011-03-14 18:10:05 +00:00
< td width = " 200 " > '.$arp_name.' </ td >
< td > '.$arp_if.' </ td >
2015-07-10 13:36:21 +02:00
</ tr > ' ;
$i ++ ;
} //end foreach
2009-11-19 19:16:01 +00:00
2015-07-10 13:36:21 +02:00
echo '</table>' ;