Jump to content

logging out a user after 15 minutes of inactivity


tmyonline

Recommended Posts

Unfortunately, I tried setting:  session.cookie_lifetime = 60 (~ 1 minute) but it did not work even after 2-3 minutes of inactivity.

 

Revraz, where can I find the Garbage Collector and what am I supposed to do with it to log out a user after 15 minutes of inactivity ?

 

Thanks.

garbage collector only eats dead sessions, not live ones it runs every 15 minutes in terms of "server" time

i.e

1:00 am

1:15 am

1:30 am

1:45 am

etc.

 

You want to have a session made at 1:04 AM become expired when the user doesn't navigate for 15 minutes so i.e 1:19 am

 

this is done with setting the life of an individual cookie or session not the garbage collectors frequency

When the page loads, create a session variable equal to the current time.  On future loads of this page, check to see if this variable has been set and if it has compare it to the current time.  If more than 15 minutes have passed, log them out.

 

You could even force the page to reload after a set amount of time which would cause this to take effect even if the user was away from the PC when it was time.  If doing this, I'd probably force the reload after 18 minutes or so to ensure that 15 minutes have actually passed.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.