RE: [PHP] online/offline script help!!
| From: | Dave VanAuken | Date: | Fri, 15 Dec 2000 23:28:14 +0000 |
| Subject: | RE: [PHP] online/offline script help!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30605@lists.php.net to get a copy of this message | ||
place unix timestamp in datetime column
do your check
$online=time()-$offline; #(assuming that $offline is a number of seconds)
$result={db}_exec("select Name from myTable where DATETIME>$online");
you have answered the rest, just drill outthe code and insert the
appropriate database tags/fields
Dave
-----Original Message-----
From: Broder B [mailto:broder_b@chello.se]
Sent: Friday, December 15, 2000 5:47 PM
To: Php General Mailing List
Subject: [PHP] online/offline script help!!
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