Repositories | Polyback | Log in to see private repositories
698 bytes | parent directory
<?php require $_SERVER['DOCUMENT_ROOT'].'/api/private/core.php';
// polygon-gameserver: a game's engine exited. {"jobId":"...","serverId":1}
use pizzaboxer\ProjectPolygon\Database;
use pizzaboxer\ProjectPolygon\Gameservers;
Gameservers::RequireAuthorized();
$body = Gameservers::Body();
Database::singleton()->run(
"UPDATE GameJobs SET Status = 'Closed', PlayerCount = 0, LastUpdated = UNIX_TIMESTAMP() WHERE JobID = :j",
[":j" => substr((string) ($body["jobId"] ?? ""), 0, 36)]
);
// nobody is in it any more
Database::singleton()->run("UPDATE GameJobPlayers SET Active = 0 WHERE JobID = :j", [":j" => substr((string) ($body["jobId"] ?? ""), 0, 36)]);
die(json_encode(["success" => true]));