how to know if a user disconnect in php ?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
oceatoon
Forum Newbie
Posts: 3
Joined: Mon Dec 19, 2005 10:08 am
Contact:

how to know if a user disconnect in php ?

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Here is a good link.
oceatoon
Forum Newbie
Posts: 3
Joined: Mon Dec 19, 2005 10:08 am
Contact:

Post 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 ?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
oceatoon
Forum Newbie
Posts: 3
Joined: Mon Dec 19, 2005 10:08 am
Contact:

Post 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
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Yes, run a cron job to remove any users after x amount of seconds without being updated.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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)
Post Reply