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!
i'm having a problem with a counter that shows the numbers of logged-in users. the bookkeeping works fine, if the users logoff from the website by using the logoff-button. but if they just close the browser, they still remain as active. this is not exactly a language-based problem, more a conceptual problem.
any ideas?
thanks and hang loose
beat
ps: i'm aware of the fact, that in general this is a client-side problem, but perhaps there are any ideas how to deal it with a server-script...)
Normal method during bookkeeping is to log when the user has performed something/reloaded. Then If current_time greater then last time done something time + (fixed time period) assume they are logged out.
Alternatively, if you're using the OO approach, and each user is an object, you can set up a destructor to log the user off (destroy the session, I guess)...
yea the best way to go is in the users table each time they reload the time update the time, and when someone else comes on the page get your script to see if the time of the last activitiy is longer than like 5min, and if so change their status to logged off