Jump to content

how to destroy session after user leaves the website?


Hyaku_

Recommended Posts

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.

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.