In an attempt to handle expiration of PHP sessions more elegantly, I introduced the following into my PHP code:
$sessionLifeTimeInSeconds = ini_get ("session.gc_maxlifetime"); echo '<script type="text/javascript">' . "\n" . ' setTimeout (function () {' . "\n" . ' alert ("Your login session will expire in 3 minutes.");' . "\n" . ' }, ' . ($sessionLifeTimeInSeconds - 180) * 1000 . ');' . "\n" . '</script>' . "\n\n";
What works. However, now I notice that after clicking the OK button in the javascript warning and no additional activity, the session does not expire when the timeout is reached (the default is 24 minutes in this case).
Should a warning popup extend my session? If so, can this be avoided, and if so, how?
I use Firefox 44.0 on Ubuntu Linux, if at all relevant.
source share