$ifIndex, 'mac' => $clean_mac]; } foreach ($mac_list as $mac_entry) { $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ? LIMIT 1", [$device['device_id'], $mac_entry['ifIndex']]); if ($port) { echo($port['ifDescr'] . ' (' . $mac_entry['ifIndex'] . ') -> ' . $mac_entry['mac']); if (dbFetchCell("SELECT COUNT(*) from `mac_accounting` WHERE `port_id` = ? AND `mac` = ?", [$port['port_id'], $mac_entry['mac']])) { echo("."); } else { $ma_id = dbInsert(['port_id' => $port['port_id'], 'device_id' => $device['device_id'], 'mac' => $mac_entry['mac']], 'mac_accounting'); echo("+"); } } else { echo("Couldn't work out interface!"); } echo("\n"); } echo("\n"); } # os_group=cisco // FIXME - NEEDS TO REMOVE STALE ENTRIES?? :O // EOF