diff --git a/globals/functions.php b/globals/functions.php index 7e7dc14..1eb7b99 100644 --- a/globals/functions.php +++ b/globals/functions.php @@ -6400,6 +6400,15 @@ function createSession($userID) { } } +function updateLastSeen($userID) { + $updateLastSeen = $GLOBALS['pdo']->prepare("UPDATE users SET lastseen = UNIX_TIMESTAMP() WHERE id = :id"); + $updateLastSeen->bindParam(":id", $userID, PDO::PARAM_INT); + if ($updateLastSeen->execute()) { + return true; + } + return false; +} + function logoutAllSessions($userID) { $sessions = $GLOBALS['pdo']->prepare("UPDATE sessions SET valid = 0 WHERE uid = :uid"); $sessions->bindParam(":uid", $userID, PDO::PARAM_INT); @@ -6769,7 +6778,11 @@ function getNav() '.$announcement.' '.$thumbnailerstatus.' '.$gameserverstatus.' -
'; + + +
'; } return '
diff --git a/html_api/sitepresence/ping.php b/html_api/sitepresence/ping.php index e265783..8d71706 100644 --- a/html_api/sitepresence/ping.php +++ b/html_api/sitepresence/ping.php @@ -4,9 +4,13 @@ Alphaland 2021 */ - //headers header("Access-Control-Allow-Origin: https://www.alphaland.cc"); - header("access-control-allow-credentials: true"); header('Content-Type: application/json'); + +$success = false; +if (updateLastSeen($GLOBALS['user']->id)) { + $success = true; +} +die(json_encode(["success" => $success])); \ No newline at end of file