online/offline script help!!
| From: | Broder B | Date: | Fri, 15 Dec 2000 22:46:44 +0000 |
| Subject: | online/offline script help!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30601@lists.php.net to get a copy of this message | ||
Yo!
I'm working on a script wich will keep track of user online or offline. =
When a user logs into a site, the script will register the user with an =
unique ID and the time when the user logged in, in a database table. On =
further requests from the user on any page of the site a script will =
query a database for the users unique id and time. If the ID exists and =
it is still valid, the script will update the time column with the =
current time. When a user has been inactive (not have had any requests =
that have updated the time coumn) the user is seen as offline. My =
problem is the time. In the database table the column is of type =
DATETIME and I want to know how to figure out if the user is online or =
not. The original idea I had is: If table_time is x min older than NOW() =
then user =3D offline
How can I do this?
Answers much appreciated
/Broder