stock aggregate table

This commit is contained in:
Thanakorn S
2026-05-25 13:30:10 +07:00
parent 293097363b
commit ba96de50a1
20 changed files with 725 additions and 62 deletions
+8
View File
@@ -88,6 +88,14 @@ if(!empty($_SESSION["login_company_id"])){
http_response_code(401);
exit(json_encode(['success' => 0, 'message' => 'You have been signed in from another device.', 'code' => 'signed_elsewhere']));
}
// Keep session_last_seen fresh (throttled: at most one DB write per 60 s).
// login_confirm.php reads this to detect when PHP GC has expired the session.
if (!isset($_SESSION['_last_seen_updated']) || (time() - $_SESSION['_last_seen_updated']) > 60) {
$pdo1->prepare("UPDATE user SET session_last_seen = NOW() WHERE user_id = :uid AND session_token = :tok")
->execute([':uid' => $_SESSION['login_user_id'], ':tok' => $_SESSION['session_token']]);
$_SESSION['_last_seen_updated'] = time();
}
}
}