ted_chou12 Posted January 15, 2007 Share Posted January 15, 2007 Ive seen a lot of forum scripts have a user online status feature, but how does it really work? is the data stored somewhere in the db or is its session cookies? can anyone give me any ideas please.Ted Link to comment https://forums.phpfreaks.com/topic/34240-how-does-the-user-online-status-work/ Share on other sites More sharing options...
utexas_pjm Posted January 15, 2007 Share Posted January 15, 2007 Usually it's implemented like this:User logs in and a timestamp is recorded.On every page or refresh the timestamp is updated.When polled for users online the script will query the user table for all timestamps between NOW() and NOW() - delta, where delta might be 10 - 15mins.This gives you an estimates as to how many users might be online. Obviously there are pitfalls. Consider a user who signs on and then immediately signs off. They will be counted as online for the next delta minutues. Also consider the user who signs on and stays on one page for > delta minutes they will not be counted until they hit refresh or browse to another page.Best,Patrick Link to comment https://forums.phpfreaks.com/topic/34240-how-does-the-user-online-status-work/#findComment-161102 Share on other sites More sharing options...
ted_chou12 Posted January 15, 2007 Author Share Posted January 15, 2007 I see, then wouldnt i have to include some thing to update the db in every user page? Link to comment https://forums.phpfreaks.com/topic/34240-how-does-the-user-online-status-work/#findComment-161104 Share on other sites More sharing options...
utexas_pjm Posted January 15, 2007 Share Posted January 15, 2007 Yeah, usually this is done in a global file that is included on every page. Link to comment https://forums.phpfreaks.com/topic/34240-how-does-the-user-online-status-work/#findComment-161115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.