[ic] how to show who is logged in

Mike Heins mike at perusion.com
Fri Oct 17 19:33:32 EDT 2003


Quoting Geoff Sternecker (geoffs at rdgi.com):
> On Friday 17 October 2003 03:55 pm, Rene Hertell wrote:
> > > In 4.9.8 Is there a feature that shows which clients are
> > > currently logged into
> > > the catalog?
> > 
> > Did you try this?
> > 
> > http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=currently+logged+
> > into+site%3A.icdevgroup.org
> 
> Yes, I had.. so I'll figure it isn't a feature.
> I figured parsing session dumps was krufty, but it works.
> I've seen similar features on bbforums and such, don't know if it's part of 
> slashcode, I'll go look.

There is a function at Admin->Info that shows the active sessions.
If you access the link, then click "Scalars" it should show the
username.

You could pretty easily modify the tag it to read the session and send out
the user name as a link instead....

If you have a very busy catalog and you think the function will be
frequently accessed, you might instead have each page access update a
small database table.

	[if session logged_in]
	    [table
		    table=logged_in
		    col=active_time
		    key="[data session username]"
		    value="[time]%Y%m%d%H%M%S[/time]"
	    ]
	[/if]

You could make it more efficient, probably, by using a TIMESTAMP.

Then a simple query:

	[tmp 30min][time adjust="-30 minutes"]%Y%m%d%H%M%S[/time][/tmp]
	[query list=1 sql="
			   SELECT * from logged_in
			   WHERE  active_time >= '[scratch 30min]'
			   ORDER BY active_time DESC
			"]

	    [loop-code] --> [loop-param active_time]
	[/query]

There are other possible ways to make it even lower-overhead; for instance
symlinking the username field to the session file and having a cron
job manage the updating on an every-minute basis.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike at perusion.com>

My wife is great.  She doesn't care where I go, just as long as I don't
have any fun.  -- Lee Trevino


More information about the interchange-users mailing list