Files
2026-09-05 13:41:26 +02:00

17 lines
613 B
PHP

<?php
require_once __DIR__ . '/include/headscript.php'; // autentica e dà $iduserlogin
require_once __DIR__ . '/class/db-functions.php';
header('Content-Type: application/json');
try {
$pdo = DBHandlerSelect::getInstance()->getConnection();
$stmt = $pdo->prepare(
"UPDATE auth_sessions SET last_activity = ? WHERE user_id = ? ORDER BY last_activity DESC LIMIT 1"
);
$stmt->execute([time(), $iduserlogin]);
echo json_encode(['ok' => true, 'rows' => $stmt->rowCount(), 'ts' => time()]);
} catch (\Throwable $e) {
echo json_encode(['ok' => false, 'error' => $e->getMessage()]);
}