Re: Users Online?

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

 



On Sat, Jun 20, 2009 at 01:33:52PM -0700, Chris Payne wrote:

> Hi everyone,
> 
> I have a login system that allows a user to login to my control panel,
> is there an easy way so that I can tell how many users / what users
> are logged into my system?  What would I need to do to add this with
> the minimum of hassle?  Would I just have to look at the sessions that
> are currently active and if so, how?  I really want to add this
> feature as it will help with creating a messaging system.

Doing this purely with sessions is impossible (well, nearly), since
sessions can't see each other. Your best bet is to add two fields to
your table(s)-- datetime logged in and datetime logged out. You'll need
to work out a way to expire someone's login if they appear to be logged
in too long (they closed their brower or left it open but forgot about
the tab for your site).

Upon login, you could perform a query of the table(s), looking for the
number of records where the logout field is empty.

Paul

-- 
Paul M. Foster

-- 
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