[ic] how to show who is logged in

Geoff Sternecker geoffs at rdgi.com
Sat Oct 18 17:02:07 EDT 2003


On Friday 17 October 2003 05:33 pm, Mike Heins wrote:

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

Thanks for the reply, I've been playing around trying to come up with 
something similar to this since the post.

-GeoffS



More information about the interchange-users mailing list