macromedia.dreamweaver.appdev
[Top] [All Lists]

Re: Viewing Online users Only

Subject: Re: Viewing Online users Only
From: Michael Fesser
Date: Tue, 26 Jun 2007 20:34:41 +0200
Newsgroups: macromedia.dreamweaver.appdev

.oO(macnux)

> im using PHP-mysql and i made a login and store user names and passwords in a 
>table and it works well .
> i want to show only the online users in a list and and if the logged in user 
>disconnected or close the browser his name disappeared from the list
> how can i do that?

It can't be done reliably. HTTP is a stateless protocol. You can't tell
if a user is still there or out for a lunch. You can't tell if he's
still watching the site, moved to another or closed his browser. It's
absolutely impossible to get accurate results, it's all just guessing
and waiting for session timeouts (most users don't logout, they just
close their browser).

In my own user management I have two fields 'lastLogin' and 'lastAccess'
in the account database. The first one is set to the current date and
time after a successful login. After that the second field is updated on
every page access.

But I only use these informations in my admin section, it's pretty
useless to show something like "xx users online" on a normal page.

Micha

<Prev in Thread] Current Thread [Next in Thread>