run("UPDATE GameJobSessions SET Active = 1 WHERE SecurityTicket = :Ticket", [":Ticket" => $Ticket]); Database::singleton()->run("UPDATE GameJobs SET PlayerCount = PlayerCount + 1 WHERE JobID = :JobID", [":JobID" => $TicketInfo->JobID]); Database::singleton()->run("UPDATE assets SET ActivePlayers = ActivePlayers + 1 WHERE id = :PlaceID", [":PlaceID" => $TicketInfo->PlaceID]); } else if ($Action == "disconnect" && $TicketInfo->Active) { Database::singleton()->run("UPDATE GameJobSessions SET Active = 0 WHERE SecurityTicket = :Ticket", [":Ticket" => $Ticket]); Database::singleton()->run("UPDATE GameJobs SET PlayerCount = PlayerCount - 1 WHERE JobID = :JobID", [":JobID" => $TicketInfo->JobID]); Database::singleton()->run("UPDATE assets SET ActivePlayers = ActivePlayers - 1 WHERE id = :PlaceID", [":PlaceID" => $TicketInfo->PlaceID]); Database::singleton()->run("UPDATE users SET ClientPresencePing = UNIX_TIMESTAMP() - 65 WHERE id = :UserID", [":UserID" => $TicketInfo->UserID]); } } else if (SESSION) { $PlaceID = $_GET["PlaceID"] ?? 0; $LocationType = $_GET["LocationType"] ?? "Visit"; $PlaceInfo = Catalog::GetAssetInfo($PlaceID); if (!$PlaceInfo || !$PlaceInfo->Version) die(""); // check if they have ownership of the place if ($LocationType == "Studio" && !$PlaceInfo->publicDomain && $PlaceInfo->creator != SESSION["user"]["id"]) { die("OK"); } Database::singleton()->run( "UPDATE users SET ClientPresenceLocation = :Location, ClientPresenceType = :LocationType, ClientPresencePing = UNIX_TIMESTAMP() WHERE id = :UserID", [":Location" => (int)$PlaceID, ":LocationType" => $LocationType, ":UserID" => SESSION["user"]["id"]] ); Users::UpdatePing(); } die("OK");