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 @@
}, },
"session": "session":
{ {
"timeout":3600,
"captcha": "captcha":
{ {
"length":3, "length":3,

13
src/server.php

@ -35,7 +35,18 @@ $server->setWelcome(
global $config; global $config;
global $session; 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] = $session[$connect] =
[ [
'time' => time(), 'time' => time(),

Loading…
Cancel
Save