|
Brian,
I did
something like that for a site, which simply runs of a set session name
(session.username) when the user logs in.
Here's the code:
----------------------------------------------------------------------------------------
<cfparam name="session.username"
default="">
<!---Does the Application.Online variable exist yet?---> <cflock name="Tracker" type="ReadOnly" timeout="5"> <cfif IsDefined("Application.Online")> <cfset CreateStructure=FALSE> <cfelse> <cfset CreateStructure=TRUE> </cfif> </cflock> <!---Create Application.Online (once
only)--->
<cfif CreateStructure> <cflock name="Tracker" type="Exclusive" timeout="5"> <cfset Application.Online=StructNew()> </cflock> </cfif> <!---Remove "old" users ("TimeOut
Minutes")--->
<!---First build a list of users "older" than "TimeOut"---> <cfset TimeOut=20> <cfset UserList=""> <cflock name="Tracker" type="ReadOnly" timeout="10"> <cfloop collection="#Application.Online#" item="ThisUser"> <cfif DateDiff("n",Application.Online[ThisUser][1],now()) GTE TimeOut> <cfset UserList=ListAppend(UserList,ThisUser)> </cfif> </cfloop> </cflock> <!---Then delete "old" users--->
<cfloop list="#UserList#" index="ThisUser"> <cflock name="Tracker" type="Exclusive" timeout="5"> <cfset Temp=StructDelete(Application.Online,ThisUser)> </cflock> </cfloop> ----------------------------------------------------------------------------------------
I dropped this
into my fbx_settings file on the root, and waa
la.
You now have a collection to Loop called:
application.online of the users who are logged into your
site.
Hope was of
assistance.
Josh Carrico
==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================ |
- Trying to display users currently on-line Brian Brown
- Re: Here you go: Trying to display users currently o... Josh Carrico
- Re: Trying to display users currently on-line Steve Bryant
- RE: Trying to display users currently on-line Shannon Hicks
- RE: Trying to display users currently on-line Daniel Daugherty
- RE: Trying to display users currently on-line Douglas Smith
- Re: Trying to display users currently on-lin... Jeff Peters
- RE: Trying to display users currently on-line Nathan Smith
