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!
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?
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.
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