0) { $results = $_POST['results']; } else { $results = 50; } print_optionbar_end(); echo('
'); $count_query = "SELECT COUNT(M.port_id)"; $full_query = "SELECT *"; $query = " FROM `ipv4_mac` AS M, `ports` AS P, `devices` AS D WHERE M.port_id = P.port_id AND P.device_id = D.device_id "; if (isset($_POST['searchby']) && $_POST['searchby'] == "ip") { $query .= " AND `ipv4_address` LIKE ?"; $param = array("%".trim($_POST['address'])."%"); } else { $query .= " AND `mac_address` 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']; } $query .= " ORDER BY M.mac_address"; $count_query = $count_query . $query; $count = dbFetchCell($count_query,$param); if(!isset($_POST['page_number']) && $_POST['page_number'] < 1) { $page_number = 1; } else { $page_number = $_POST['page_number']; } $start = ($page_number - 1) * $results; $full_query = $full_query . $query . " LIMIT $start,$results"; echo(''); foreach (dbFetchRows($full_query, $param) as $entry) { if (!$ignore) { //why are they here for? //$speed = humanspeed($entry['ifSpeed']); //$type = humanmedia($entry['ifType']); if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) { $error_img = generate_port_link($entry,"Interface Errors",errors); } else { $error_img = ""; } $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($entry['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'] == $entry['device_id']) { $arp_name = "Localhost"; } if ($arp_host['port_id'] == $entry['port_id']) { $arp_if = "Local port"; } echo(''); } unset($ignore); } if($count % $results > 0) { echo(' '); } echo('
ARP Entries
MAC AddressIP AddressDeviceInterfaceRemote deviceRemote interface
' . formatMac($entry['mac_address']) . ' ' . $entry['ipv4_address'] . ' ' . generate_device_link($entry) . ' ' . generate_port_link($entry, makeshortif(fixifname($entry['ifDescr']))) . ' ' . $error_img . ' '.$arp_name.' '.$arp_if.'
'. generate_pagination($count,$results,$page_number) .'
'); ?>