');
$query = "SELECT * FROM `ports` AS P, `devices` AS D WHERE P.device_id = D.device_id ";
$query .= "AND `ifPhysAddress` LIKE ?";
$param = array("%".str_replace(array(':', ' ', '-', '.', '0x'),'',mres($_POST['address']))."%");
if (is_numeric($_POST['device_id']))
{
$query .= " AND P.device_id = ?";
$param[] = $_POST['device_id'];
}
if ($_POST['interface'])
{
$query .= " AND P.ifDescr LIKE ?";
$param[] = $_POST['interface'];
}
$query .= " ORDER BY P.ifPhysAddress";
echo('Device | Interface | MAC Address | Description |
');
foreach (dbFetchRows($query, $param) as $entry)
{
if (!$ignore)
{
$speed = humanspeed($entry['ifSpeed']);
$type = humanmedia($entry['ifType']);
if ($entry['in_errors'] > 0 || $entry['out_errors'] > 0)
{
$error_img = generate_port_link($entry,"
",errors);
} else { $error_img = ""; }
if (port_permitted($entry['port_id']))
{
$interface = ifLabel ($interface, $interface);
echo('
' . generate_device_link($entry) . ' |
' . generate_port_link($entry, makeshortif(fixifname($entry['ifDescr']))) . ' ' . $error_img . ' |
' . formatMac($entry['ifPhysAddress']) . ' |
' . $entry['ifAlias'] . " |
\n");
}
}
unset($ignore);
}
echo("");
?>