Jump to content

Recommended Posts

Hi!
I'm using sessions on my website. I want users to be logged out automaticly after they leave my website, instead of manualy logging out all the time! And I need the session to be destroyed imidietly not after some time! Is this posible? Any suggestions? Thank you!
You cant really tell if someone has left your site.  They could of closed it, quit it, their machine could crash.  Only way I guess would be to somehow set up a cron job to go through the directory were the sessions are kept and if they havent been used within a set time, delete it?



You cannot destroy the session immediatly as soon the user leaves your site. The only the way you do this is to lower the lifetime of the session, to something like 5mins however if the user leaves his computer for 5mins or more thier session will be destroyed, thefore when they return they'll most probably get a session timeout error message of some sort.

Also sessions become invalid when the user closes their browser and goes to return to your site.
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.