Page 1 of 1

ending $_SESSION[] variable when user goes off site

Posted: Thu Apr 20, 2006 2:24 pm
by MrHamburger
Hello,

I am using $_SESSION variables for user authentication on a site. I was wondering if it is possible (using PHP, or anything else) to end a session when a user goes off the site (without logging out); or at least to end the session if a user closes the browser window (but does not quit the browser application). Thanks a lot.

Posted: Thu Apr 20, 2006 2:29 pm
by feyd
Their session is destroyed (normally) when they close their browser. There is no reliable way to detect them leaving your site. Set your sessions to expire quickly (30 minutes, maybe) if need be.