Jump to content

Is there such thing as a timer or only page refresh time limit?


nutt318

Recommended Posts

Well I a page that requires a password to view the contents. Once a user logs in with this password the page times out after 5 minutes and prompt them to reenter their password.

 

So how would I make this page after those 5 mins run another php function? Is there some sort of timer I can have that runs every 5mins without someone actually being on the page?

 

Thanks for your help.

So using Javascript can act as a timer and say every 5mins the timer will run my code to log them out?

 

If you set it that when the time is up, it uses location.href to redirect to your logout page which automatically logs them out, yes.

 

If you want a more reliable system, you would need to store a timestamp in the DB of last activity and have a cron job run every minute checking if the activity was more than 5 minutes ago, if so kill the cookies and session which should log them out.

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.