session - User Inactivity Logout PHP -


I want my users to be automatically logged out after X minutes of inactivity. I also want to delete all the sessions

How can this be done? How do I check for inactivity, then I can do a function to log out ??? You can also:

You can also:

  $ _ session [ Login time '] = time ();  

On every page, and when the user is trying to navigate and he is inactive for twenty minutes, you can log him out like this:

  if ($ _ session ['login time'] & lt; time () + 20 * 60) {logout (); }  

Comments