18 lines
506 B
PHP
18 lines
506 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/** API-Controller (Presence) - 1:1 aus api.php. */
|
|
final class PresenceController
|
|
{
|
|
public function heartbeat(): void
|
|
{
|
|
$pdo = Database::pdo();
|
|
$now = time();
|
|
$authUserId = $_SESSION['user_id'] ?? null;
|
|
if ($authUserId) {
|
|
$pdo->prepare('UPDATE gtl_users SET last_seen=?, current_room=NULL WHERE id=?')
|
|
->execute([$now, $authUserId]);
|
|
}
|
|
respond(['ok' => true]);
|
|
}
|
|
}
|