';
echo '
| Port | MAC address | IPv4 address | Remote device | Remote port |
';
$i = '1';
foreach (dbFetchRows('SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.port_id = M.port_id AND I.device_id = ?', array($device['device_id'])) as $arp) {
if (!is_integer($i / 2)) {
$bg_colour = $list_colour_a;
}
else {
$bg_colour = $list_colour_b;
}
$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']));
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['port_id'] == $arp['port_id']) {
$arp_if = 'Local Port';
}
echo "
| ".generate_port_link(array_merge($arp, $device)).' |
'.formatmac($arp['mac_address']).' |
'.$arp['ipv4_address']." |
$arp_name |
$arp_if |
";
$i++;
}//end foreach
echo '';