I am setting an application variable in application.cfm to keep track of
active users on my site.


I have the session time out set to 40 minutes in my cfapplication tag
(<cfapplication name="personal" clientmanagement="yes"
sessionmanagement="Yes" setclientcookies="Yes"
sessiontimeout="#CreateTimeSpan(0,0,40,0)#">)  The problem is the
application variable is timing out before the 40 minutes even if the
person is still active on the site. I have added the code below. Can
someone tell me how I can solve this problem.

<!--- Who Is On --->
<cflock timeout="40" scope="APPLICATION" type="EXCLUSIVE">
<cfif NOT isDefined("Application.UsersInfo")>
<cfset Application.UsersInfo = StructNew()>
</cfif>
</cflock>
<!--- Remove From Who Is On List After 40 Minutes --->
<cflock scope="APPLICATION" type="EXCLUSIVE" timeout="40">
<cfloop collection="#Application.UsersInfo#" item="itmUser">
<cfif
Evaluate(DateDiff("n", StructFind(Application.UsersInfo, itmUser),
Now())) GT 40
>
<cfset StructDelete(Application.UsersInfo, itmUser)>
</cfif>
</cfloop>
</cflock>


<!--- Display Code  (Not In application.cfm) - - - >


<cflock scope="APPLICATION" type="EXCLUSIVE" timeout="40">
<cfoutput>
On Line : #StructCount(Application.UsersInfo)#<br>
</cfoutput>
</cflock>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to