Re: who's on-line application - php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux