Browse Source

cleanup expired sessions

main
ghost 7 months ago
parent
commit
ba90183547
  1. 1
      example/config.json
  2. 13
      src/server.php

1
example/config.json

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

13
src/server.php

@ -35,7 +35,18 @@ $server->setWelcome( @@ -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(),

Loading…
Cancel
Save