I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I’d like to present the user with a message stating why they were logged out and redirect them to the login page.
What is the best way to handle this?
I am running on php and myadmin.
Thanks
Avinash
Every time you load a page, store a timestamp in a session variable. When the user goes to a page, check to see if
$SESSION['lastActivity'] < time() - <your idle time>. If true, then redirect to a ‘your session has expired’ page or similar. If not, continue loading the page.