Re: [phplib] current users? From: Michael Chaney (mdchaney <email protected>)
Date: 08/21/01

On Tue, Aug 21, 2001 at 09:33:36PM -0400, tps <email protected> wrote:
> Hi folks.
> I've been beating my few brains out trying to figure out how to
> tell how many users, and who they are, have active sessions. This
> looks to be straight forward, but I must not be much of a programmer
> since I can't figure out how to do this. Anyone have a pointer, or
> code
> snipet?
 
How do you define an active user? Think about that. If you want to
know how many people have brought up a page in the last 15 minutes, you
can do that easily with a query (this is MySQL):
 
select count(*) from active_sessions
        where changed>=date_format(now()-interval 15 minute,'%Y%m%d%H%I%S')
                                and name='CE_Session';
 
You can easily use something like that to remove the inactive sessions
via a simple cron job every 15 minutes or so, and alleviate the problem
of "garbage collection" in your web application.
 
Michael

--
Michael Darrin Chaney
mdchaney <email protected>
http://www.michaelchaney.com/

-- Abbestellen mit Mail an: phplib-unsubscribe <email protected> Kommandoliste mit Mail an: phplib-help <email protected>