" . mac_clean_to_readable($clean_mac), $device, "interface", $interface['interface_id']); } mysql_query($sql); echo("."); } else { echo("+"); #echo("Add MAC $mac\n"); mysql_query("INSERT INTO `ipv4_mac` (interface_id, mac_address, ipv4_address) VALUES ('".$interface['interface_id']."','$clean_mac','$ip')"); } $interface_id = $interface['interface_id']; } $sql = "SELECT * from ipv4_mac AS M, ports as I WHERE M.interface_id = I.interface_id and I.device_id = '".$device['device_id']."'"; $query = mysql_query($sql); while ($entry = mysql_fetch_assoc($query)) { $entry_mac = $entry['mac_address']; $entry_if = $entry['interface_id']; if (!$mac_table[$entry_if][$entry_mac]) { mysql_query("DELETE FROM ipv4_mac WHERE interface_id = '".$entry_if."' AND mac_address = '".$entry_mac."'"); if ($debug) { echo("Removing MAC $entry_mac from interface ".$interface['ifName']); } echo("-"); } } echo("\n"); unset($mac); ?>