/** * Callback Function to check if user actually exists */ function onSyncResultNumberCheck($result) { global $DBH, $tracking_numbers, $wa; // Set whatsapp users verified=true foreach ($result->existing as $number) { $number = explode("@", $number)[0]; $update = $DBH->prepare('UPDATE accounts SET "verified" = true WHERE "id" = :number;'); $update->execute(array(':number' => $number)); // Add user to the current tracking system array_push($tracking_numbers, $number); // Add call for event listener $wa->SendPresenceSubscription($number); echo ' -[verified] Added verified ' . $number . ' to the tracking system.' . "\n"; checkLastSeen($number); checkProfilePicture($number); } // Set non-whatsapp users inactive foreach ($result->nonExisting as $number) { $number = explode("@", $number)[0]; $update = $DBH->prepare('UPDATE accounts SET "active" = false WHERE "id" = :number;'); $update->execute(array(':number' => $number)); } }
/** * Callback Function to check if user actually exists */ function onSyncResultNumberCheck($result) { global $DBH, $tracking_numbers, $wa, $whatsspyNotificatons; // Set whatsapp users verified=true foreach ($result->existing as $number) { $number = explode("@", $number)[0]; $update = $DBH->prepare('UPDATE accounts SET "verified" = true WHERE "id" = :number;'); checkDatabaseInsert($update->execute(array(':number' => $number))); // Add user to the current tracking system array_push($tracking_numbers, $number); // Add call for event listener $wa->SendPresenceSubscription($number); tracker_log(' -[verified] Added verified ' . $number . ' to the tracking system.'); sendNotification($DBH, $wa, $whatsspyNotificatons, 'user', ['title' => ':name is verified', 'description' => ':name is verified as a WA user.', 'number' => $number, 'notify_type' => 'verify']); checkLastSeen($number); checkProfilePicture($number); checkStatusMessage($number); } // Set non-whatsapp users inactive foreach ($result->nonExisting as $number) { $number = explode("@", $number)[0]; $update = $DBH->prepare('UPDATE accounts SET "active" = false WHERE "id" = :number;'); checkDatabaseInsert($update->execute(array(':number' => $number))); tracker_log(' -[verified] Number ' . $number . ' is NOT a WhatsApp user.'); sendNotification($DBH, $wa, $whatsspyNotificatons, 'user', ['title' => ':name is verified', 'description' => ':name is not a WA user.', 'number' => $number, 'notify_type' => 'verify']); } }