cleanup expired sessions

This commit is contained in:
ghost 2024-04-30 15:00:37 +03:00
parent e01aebd66d
commit ba90183547
2 changed files with 13 additions and 1 deletions

View File

@ -21,6 +21,7 @@
},
"session":
{
"timeout":3600,
"captcha":
{
"length":3,

View File

@ -35,7 +35,18 @@ $server->setWelcome(
global $config;
global $session;
// Init session
// Cleanup expired sessions
foreach ($session as $key => $value)
{
if ($value['time'] + $config->nps->session->timeout < time())
{
unset(
$session[$key]
);
}
}
// Init new session
$session[$connect] =
[
'time' => time(),