Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.