mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Initial commit
This commit is contained in:
parent
41a138026b
commit
6f1c34f28d
28
ajax/session/do_check_session.php
Normal file
28
ajax/session/do_check_session.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require '../../includes/csrf.php';
|
||||||
|
require_once '../../includes/session.php';
|
||||||
|
require_once '../../includes/config.php';
|
||||||
|
require_once '../../src/RaspAP/Auth/HTTPAuth.php';
|
||||||
|
require_once '../../includes/authenticate.php';
|
||||||
|
|
||||||
|
$lastActivity = $_SESSION['lastActivity'] ?? time();
|
||||||
|
$sessionLifetime = time() - $lastActivity;
|
||||||
|
$status = $sessionLifetime >= RASPI_SESSION_TIMEOUT ? 'session_expired' : 'active';
|
||||||
|
|
||||||
|
// send response
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||||
|
header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'status' => $status,
|
||||||
|
'last_activity' => $lastActivity,
|
||||||
|
'session_lifetime' => $sessionLifetime,
|
||||||
|
'timeout_duration' => RASPI_SESSION_TIMEOUT
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
|
exit();
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user