crouchjay Posted June 14, 2006 Share Posted June 14, 2006 I have a table for users that are currently online, how do I set them offline if they click the close browser button? Can I retrieve this action? Thanks for your help? Link to comment https://forums.phpfreaks.com/topic/11976-log-off/ Share on other sites More sharing options...
.josh Posted June 14, 2006 Share Posted June 14, 2006 possibly with some javascript event checking like an onclose, doing some ajax to update it. but i'm not sure if it is possible for you to get onclose to execute a function if the user straight up clicks the close window X button. it is for sure not possible with only php. Link to comment https://forums.phpfreaks.com/topic/11976-log-off/#findComment-45498 Share on other sites More sharing options...
crouchjay Posted June 14, 2006 Author Share Posted June 14, 2006 How do other sites take care of this problem? Do I need to create a deamon that checks connectivity of users every so often? Link to comment https://forums.phpfreaks.com/topic/11976-log-off/#findComment-45506 Share on other sites More sharing options...
joquius Posted June 14, 2006 Share Posted June 14, 2006 it's simple, you have an expiry for the session which is set to about lets say 30 minutes after each action of that same user within the site, then in the session verification which each user has on every page load add an sql line which checks `expire` vs. the time() and those which are less than time() are deleted (logged off) Link to comment https://forums.phpfreaks.com/topic/11976-log-off/#findComment-45510 Share on other sites More sharing options...
.josh Posted June 14, 2006 Share Posted June 14, 2006 yes, you will have to do like a cron job to check the last activity of the person, if you want strictly php. with php you simply don't know if the user is taking a really long time reading a post or something, or if they closed their browser or what. Link to comment https://forums.phpfreaks.com/topic/11976-log-off/#findComment-45619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.