Session destroy

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
verdi
Forum Newbie
Posts: 3
Joined: Fri Jul 01, 2005 6:48 am
Contact:

Session destroy

Post 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!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
deep_fire
Forum Newbie
Posts: 7
Joined: Fri Jun 24, 2005 2:34 pm
Contact:

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

Post 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
Post Reply