This is a discussion on logoff user with php *urgent* within the PHP Language forums, part of the PHP Programming Forums category; Hello, If somebody could help me with this one it would be very nice, the story: I need to check ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
If somebody could help me with this one it would be very nice, the story: I need to check if a user is online or not at the moment i am doing a user logoff with javascript but this is not browser proof so it doesn't work all the time. or doing it with a for() statement that writes every 20 sec the last unix time to a database, this doesn't work because the for() statements stops executing the rest of the page so that doesn't work either the problem: i can only have one user online for a group, so i have to check if the first that logges in for a group is online or not, i have a check time of 1 minut so if a user logges off, a new user can login after a minut. the reason: so you think what is the problem put a logoff button on the screen and your finished, well that would be the answer if i wasn't developing a page for idiots that destroy the browser window by alt-f4 or the cross instead of the logoff button. so hope somebody hacked this problem before. Thanks in advance (sorry for the multi post) G |
|
|||
|
In article <3f7bf275$0$58710$e4fe514c@news.xs4all.nl>, Spam sucks wrote:
> Hello, > > If somebody could help me with this one it would be very nice, > > the story: > I need to check if a user is online or not at the moment i am doing a user > logoff with javascript but this is not browser proof so it doesn't work all > the time. or doing it with a for() statement that writes every 20 sec the > last unix time to a database, this doesn't work because the for() statements > stops executing the rest of the page so that doesn't work either > > the problem: > i can only have one user online for a group, so i have to check if the first > that logges in for a group is online or not, i have a check time of 1 minut > so if a user logges off, a new user can login after a minut. You can have function check_timeouts() and store_time() that are called everytime a page is requested. The store_time function only has to store the current_time. The check_timeouts function has to compare current_time with stored_time. If the difference for a user > 60, log the user out. -- Visit my website at http://aardbei.madoka.be |
|
|||
|
"Spam sucks" <nomail> wrote in message
news:<3f7bf275$0$58710$e4fe514c@news.xs4all.nl>... > > I need to check if a user is online or not at the moment You can't. All you can do is to figure out who accessed your site within the last X minutes, hours, or days. > so hope somebody hacked this problem before. Of course. You must assume that the user is offline, unless you have reasons to believe otherwise (e.g., a recent access to a page on your site with that user's credentials). Cheers, NC |