[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Displaying Users Online
On Thu, Jan 17, 2002 at 09:15:06AM -0800, Ed LaFrance wrote:
> At 05:57 PM 01/16/2002 -0800, you wrote:
> >Hi All,
> >
> >I need to show the # of user's currently logged in. Can someone help?
> >
> >Output example of what I need...
> >
> >User's Currently Online: [code here]
>
> I would suggest using the [counter] tag. Set up a file called
> etc/logged_users, increment it each time someone logs in, and decrement it
> when someone logs out. The you can do:
>
> User's Currently Online: [counter file=etc/logged_users value=1]
We've started to keep a session hash for the catalog as a whole.
So you'd write a tag that would put the user logged in into a
hash when they log in, with whatever attributes
%SESSION={
%LOGGED_IN={
%user1=>{
attr1=>asdf
attr2=>asdf
attr3=>asdf
timestamp1=>now()
}
}
%TIMESTAMPS={
'timestamp1'=>[$SESSION->{LOGGED_IN}->$user1,...
'timestamp2'=>[$SESSION->{LOGGED_IN}->$user2,...
}
}
Just guessing at the structure; we don't actually do this for users
but for "rare items" in carts, decrementing inventory on a temporary
basis. You do want some sort of timestamp index so you can expire
logins automatically.
Then you'd put a tag or autoload function that checks login status
and init session if too long or not found, blow away old data, that
sort of thing.
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Content/site management, online commerce, internet integration, Debian linux