Page 1 of 1

how to know if a user disconnect in php ?

Posted: Mon Dec 19, 2005 10:19 am
by oceatoon
Hi every one

I'm looking for an existing structure or tips on experience on building a connected user
system for mysite?

where I play on general looks of the icons for different users according to their status.

I can save there status when they log on , but how to know when they disconnect ?

are there any existing systems that might do somethign similar ?

regards
Tibor

Posted: Mon Dec 19, 2005 10:32 am
by Burrito

Posted: Mon Dec 19, 2005 12:07 pm
by m3mn0n
Here is a good link.

Posted: Mon Dec 19, 2005 12:22 pm
by oceatoon
Thanks burrito that's what I was looking for
but I don't see how the disconnection is dealt with ?
how will a certain user be pulled out of the online table ?

sorry, Sami I don't see the link with the subject ?

Posted: Mon Dec 19, 2005 12:28 pm
by Burrito
the user will be yanked off the online table if they close the browser, the XMLHttp request will stop and therefore the timestamp on the table will quit being updated.

Posted: Mon Dec 19, 2005 12:38 pm
by oceatoon
so you keep the last visit time as in db ,
it's updated but never removed?

is there a way of removing once disconnected ?
so that online table only carries connected users ?

Thx

Posted: Mon Dec 19, 2005 12:54 pm
by hawleyjr
Yes, run a cron job to remove any users after x amount of seconds without being updated.

Posted: Mon Dec 19, 2005 1:01 pm
by feyd
it doesn't need a cron.. simply running a removal of "old" users from the "active" list prior to fetching the active list can be far easier to work with. (And supported and supportable)