this is a bit of a biggy and I never got round to working out how to display code nicely in these forums
I've used the new application.cfc and related framework to track the amount of live sessions in an application scope array - ..
<cfcomponent namespace="Application.cfc" output="Yes" >
<cfscript>
//set attributes normally set in the cfapplication tag.
this.Name = "appnane";
this.applicationTimeout = createTimeSpan(7,0,0,0);
this.sessionManagement = "yes";
this.sessionTimeout = CreateTimeSpan(0, 0, 0,30);
this.scriptProtect = "all";
this.setDomainCookies = "true";
this.setClientCookies = "true";//defaults to true but incase
</cfscript>
<cffunction name="onApplicationStart"
returnType="boolean" output="Yes">
<cfscript>
//create structure to contain a reference to all users...
//here you would put initialisation code
APPLICATION.allUsers = arrayNew(1);
</cfscript>
<cfreturn true />
</cffunction>
<cffunction name="onSessionStart">
<cfscript>
//session initilisation
SESSION.user = structnew();
SESSION.user.sessionID = createUUID();
SESSION.user.started = now();
SESSION.user.isLoggedIn = false;
</cfscript>
<cflock scope="Application" timeout="5" type="Exclusive">
<cfscript>
//add new session to our global structure....
arrayAppend(Application.allUsers,SESSION.user);
</cfscript>
</cflock>
<cfreturn true />
</cffunction>
<cffunction name="onRequestStart" returnType="boolean">
<cfargument type="String" name="targetPage" required=true/>
<cfscript>
//not locked - not worried about a race condition
SESSION.user.lastPageRequested = arguments.targetPage & "?" & cgi.query_string;
SESSION.user.timeOfLastRequest = now();
</cfscript>
<cfreturn true>
</cffunction>
<!--- when session ends remove this session from our application scope structure! --->
<cffunction name="onSessionEnd" returnType="void">
<cfargument name="SessionScope" required=True/>
<cfargument name="ApplicationScope" required=False/>
<!--- find the session which is ending so we can remove it from our structure --->
<cfloop from="1" to="#arrayLen(Arguments.ApplicationScope.allUsers)#" index="i" >
<cfif Arguments.ApplicationScope.allUsers
.sessionID eq arguments.SessionScope.user.sessionID >
<!--- remove from the structure (lock?) --->
<cfset ArrayDeleteAt(Arguments.ApplicationScope.allUsers, i) />
<cfbreak>
</cfif>
</cfloop>
</cffunction>
</cfcomponent>
this code works but may need reviewing to ensure there are no nasty race conditions. The new application framework is cool but there are a lot of gotchas to be aware of such as code just not working if there is an error in some of the method (and *not* ) throwing an error. There is a whole new section of documentation in livedocs on this - I would recommend reading it carefully as I tripped up a lot of things which are in the docs but who really RTFM? 