|
Posted by Stefan Dengscherz on 10/04/50 11:08
Hello,
usually you can not determine clearly who is online on your website at the
moment because http is a session-less protocol (thus php implements a session
mechanism through cookies or session id). However you can use the following
approach:
- add a 'last_seen' field to the users table of your website
- update that field for the user everytime he calls a page on your site
(e.g. include("updatels.php"); on every page)
- to get the number of (probably still) online users do a 'select from
user_table where now()-lastseen < 3 minutes'
another method would be changing the session handler to store session data in
the database and query the sessiontable appropriately.
best regards,
Stefan Dengscherz
On Mon, Feb 14, 2005 at 04:30:32PM +0200, Jacques wrote:
> I would like to indicate the particulars (from a MySQL database) of all
> those users that are currently on-line (those whom have successfully signed
> in). How should I go about achieving this? Does it have something to do with
> Sessions?
>
> I am developing in PHP.
>
> Regards
>
> Jacques
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
[Back to original message]
|