die; } else { if ($do == "update") { $scan = Scan::fromDB($id); $data = $scan->parseCSV(); $aps = $data["aps"]; $clients = $data["clients"]; // Update scan counts for APs and Clients $scan->setAPCount(count($aps)); $scan->setClientCount(count($clients)); // Add APs to DB if they aren't already there foreach ($aps as $ap) { $check = AP::fromDB($scan->getID(), $ap["bssid"]); // Add AP if not found if ($check->getID() == null) { AP::newAP($scan->getID(), $ap["bssid"], strtotime($ap["first_seen"]), strtotime($ap["last_seen"]), $ap["channel"], $ap["privacy"], $ap["cipher"], $ap["authentication"], $ap["power"], $ap["beacons"], $ap["ivs"], $ap["essid"], round($_POST['lat'], 7), round($_POST['long'], 7)); // Update AP in DB } else { // Update Coordinates if seen within last 10 seconds if ($wicker->timeconv(strtotime($ap["last_seen"])) == "Just now") { $check->setLatitude(round($_POST['lat'], 7)); $check->setLongitude(round($_POST['long'], 7)); } $check->setLastSeen(strtotime($ap["last_seen"])); $check->setBeacons($ap["beacons"]); $check->setIVs($ap["ivs"]); $check->setPower($ap["power"]); // If this is an individual scan and not OPN or WEP, perform handshake check if ($scan->getIndividual() == 1 && $check->getHandshake() != 1 && !in_array($check->getPrivacy(), array("WEP", "OPN"))) { if ($scan->capturedHandshake()) { $check->setHandshake(1);