0

I need to get the remaining time for a session until expiration. I know sessions work by garbage collection & the max lifetime is not very accurate but i need a way to detect when a session will expire.

from:retrieve php server session timeout

$maxlifetime = ini_get("session.gc_maxlifetime");

returns: 1440

interesting post: How do I expire a PHP session after 30 minutes?

Community
  • 1
  • 1
  • iv'e been up for 48 hours straight, so i might be over thinking this a little to much. – richard grant Mar 13 '16 at 18:32
  • @C.Liddell so what you are saying is that i should create a SESSION variable less than 1440 seconds that will be the expire time? – richard grant Mar 13 '16 at 18:36
  • If you have a request for a PHP file the session timeout will be reset, so it is 1440 seconds (or whatever the value of `ini_get('session.gc_maxlifetime')` is) again, if you want for example have a javascript timer counting down. – syck Mar 13 '16 at 18:42

0 Answers0