mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Add csrf token check, destroy session on timeout
This commit is contained in:
5
ajax/session/do_check_session.php
Normal file → Executable file
5
ajax/session/do_check_session.php
Normal file → Executable file
@@ -10,6 +10,11 @@ $lastActivity = $_SESSION['lastActivity'] ?? time();
|
||||
$sessionLifetime = time() - $lastActivity;
|
||||
$status = $sessionLifetime >= RASPI_SESSION_TIMEOUT ? 'session_expired' : 'active';
|
||||
|
||||
if ($status = 'session_expired') {
|
||||
session_unset(); // unset all session variables
|
||||
session_destroy(); // destroy the session
|
||||
}
|
||||
|
||||
// send response
|
||||
header('Content-Type: application/json');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
|
Reference in New Issue
Block a user