sudya Posted June 21, 2007 Share Posted June 21, 2007 Here is what I want to do - when the user uses the page the session is created. As soon as the user closes the page I want to catch that moment and perform last second things like committing data to DB, writing logs, etc. So how so I catch the fact that the user broke the session? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/56478-detect-that-session-in-broken/ Share on other sites More sharing options...
soycharliente Posted June 21, 2007 Share Posted June 21, 2007 I don't know that you can know when they close the page. If you're using sessions while logged in, you could run it when they log out. Quote Link to comment https://forums.phpfreaks.com/topic/56478-detect-that-session-in-broken/#findComment-278945 Share on other sites More sharing options...
corbin Posted June 21, 2007 Share Posted June 21, 2007 That would be a bit creepy if you could know when ever a user left your site. You can, however, log the last time a session was active such as when a user loads a page, and then use that information to expire sessions if the last action was >= X seconds ago. Then you could do some logging with that stuff (I think that's how SMF knows how long you've been on the boards), but you could not, for example, get where a user went when leaving your site (unless you had dynamic links and they followed one). Quote Link to comment https://forums.phpfreaks.com/topic/56478-detect-that-session-in-broken/#findComment-278946 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.