I think you have a situation where the sessions are staying active long
after the user logs off.  Run that loop and let me know what you get
back.  Your problem will probably be obvious then.

Ryan Duckworth
Macromedia ColdFusion Certified Professional
Uhlig Communications
10983 Granada Lane
Overland Park, KS 66211
(913) 754-4272

  _____  

From: Sung Woo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 17, 2004 3:18 PM
To: CF-Talk
Subject: Count Online Users Conundrum

I got this little snippet from easycfm.com to keep track of online
users, but lately, it hasn't been working quite right.  What happens is
that at the end of the day (I run an intranet where there are about 200
peak users), around midnight, it still shows 80 or so users online!
What do you think could be causing this?

<!--- http://tutorial12.easycfm.com/ - show session users - BEGIN --->

<cflock timeout="15" scope="APPLICATION" type="EXCLUSIVE">
    <cfif NOT isDefined("Application.UsersInfo")>
          <cfset Application.UsersInfo = StructNew()>
    </cfif>
</cflock>

<cflock name="#CreateUUID()#" timeout="15" type="EXCLUSIVE">
      <cfset user_cfid = Evaluate(CFID)>
      <cfset user_time = Now()>
</cflock>

<cflock scope="APPLICATION" type="EXCLUSIVE" timeout="15">
<cfif NOT StructKeyExists(Application.UsersInfo, user_cfid)>
  <cfset temp = StructInsert(Application.UsersInfo, user_cfid,
user_time)>
</cfif>
</cflock>

<cflock scope="APPLICATION" type="EXCLUSIVE" timeout="15">
<cfloop collection="#Application.UsersInfo#" item="itmUser">
  <cfif
   Evaluate(DateDiff("n", StructFind(Application.UsersInfo, itmUser),
Now())) GT 15
  >
    <cfset StructDelete(Application.UsersInfo, itmUser)>
  </cfif>
</cfloop>
</cflock>

<!--- http://tutorial12.easycfm.com/ - show session users - END --->

-----

<!--- http://tutorial12.easycfm.com/ - show session users --->

<cflock scope="APPLICATION" type="EXCLUSIVE" timeout="10">
    <cfoutput>
         Total Active Sessions : #StructCount(Application.UsersInfo)#
    </cfoutput>
</cflock>

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to