<cfset tracker = createObject("java","coldfusion.runtime.SessionTracker")>
<cfoutput><p>There are #tracker.getSessionCount()# active
sessions</p></cfoutput>
<cfset sk = tracker.getSessionKeys()>
<cfset count_logged_in = 0>
<cfloop condition="#sk.hasNext()#">
<cfset k = sk.nextElement()>
<cfset s = tracker.getSession(k)>
<cfif StructKeyExists(s, "whatever key you use to check whether
somebody is
logged in")>
<cfset count_logged_in = count_logged_in + 1>
</cfif>
</cfloop>
<cfoutput><p>There are #count_logged_in# logged in users</p></cfoutput>
Jaime Metcher
> -----Original Message-----
> From: Joel Watson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 17 April 2007 12:03 PM
> To: CF-Talk
> Subject: Display number of users online
>
>
> I have a site (a forum, really) that allows users to login and
> post messages. Is there a way that I can display the number of
> users that are currently logged in?
>
> Thanks!
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2.
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275502
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4