[imp] Re: [horde] Who is online?
Andrew Morgan
morgan at orst.edu
Sun Sep 7 22:07:23 PDT 2003
On Mon, 8 Sep 2003, Sn!per wrote:
> Charles Robinson wrote:
> > The way I tell is from the logs.
> > The logs shows when someone logs in & logs out of horde.
>
> could we, instead, simulateneously write the login/logout info to db
> (and /tmp/horde.log) and then access it from there. could this technique
> be faster than opening/reading/and searching thru unix filesystem ?
>
> please advise.
We just parse the session table to get a count of logged in users. You
can't tell if someone just walks away without clicking the logout button,
but that's about the only downside. Here is the chunk of perl code we use
to get the count of authenticated users:
# Get authenticated session count
$sth = $dbh->prepare("SELECT count(*)
FROM horde_sessionhandler
WHERE session_data like '%authenticated%'");
$sth->execute();
($auth) = $sth->fetchrow_array;
$auth = 0 if (! defined($auth));
You could probably parse the session data further to break out the
usernames of currently logged in users, but we don't really care here.
Andy
More information about the imp
mailing list