Page 1 of 1

Session destroy

Posted: Sat Jul 09, 2005 4:11 am
by verdi
When users surf in site A where a session is started, then load a new site B in the same window, and after that go back to the previous one (A), the session is still alive.

How can I destroy the session when the user leaves the site without logging out?

Thank you!

Posted: Sat Jul 09, 2005 5:45 am
by timvw
How would you define "leave the site"?

HTTP is stateless. So all people can do, is estimate that if you don't request a new page in a given amount of time, they are still on active on your site...

You could look at $_SERVER['HTTP_REFERER'] but that is not a very reliable source either.

Re:How would you define "leave the site"?

Posted: Sat Jul 09, 2005 4:42 pm
by deep_fire
web servers gives an id your session when you open your browser. if you open a window on first window. session ids to be similar. This is not change. but you can learn adress of referer with $_SERVER['HTTP_REFERER'] function