in your application.cfm template
<!--- start users online --->
<!--- does the user already exist --->
<CFLOCK SCOPE="Application" Timeout="15" type="Exclusive">
<cfif NOT isdefined("Application.UsersInfo")>
<cfset Application.UsersInfo = StructNew()>
</cfif>
</CFLOCK>
<!--- reference the structure using UUID --->
<cflock name="#CreateUUID()#" timeout="15" type="exclusive">
<cfset user_cfid = Evaluate(CFID)>
<cfset user_time = Now()>
</cflock>
<!--- check to see if the user has already been counted --->
<cflock timeout="15" type="exclusive" scope="application">
<cfif NOT StructKeyExists(Application.UsersInfo, user_cfid)>
<cfset temp = StructInsert(Application.UsersInfo, user_cfid,
user_time)>
</cfif>
</cflock>
<!--- delete dormant or users that have left --->
<cflock timeout="15" type="exclusive" scope="application">
<cfloop collection="#Application.UsersInfo#" item="itmUser">
<cfif
Evaluate(DateDiff("n", StructFind(Application.UsersInfo, itmUser),
Now())) GT 10>
<cfset StructDelete(Application.UsersInfo, itmUser)>
</cfif>
</cfloop>
</cflock>
where you want to display it
<!--- show active users --->
<cflock timeout="10" type="exclusive" scope="application">
<cfoutput>
#StructCount(Application.UsersInfo)# visitors currently online
</cfoutput>
</cflock>
----- Original Message -----
From: "Blood Python" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, May 28, 2003 12:58 AM
Subject: Number of users brownsing website
> hi all.
>
> I've done a portal using FB3 for one of my clients and he wants to display
> the number of users browsing his website.
>
> I was thinking about using some session variables to do that and put the
> code in the main fbx_settings.cfm. Maybe some of you guys have made
> something like that and could give me a better idea or maybe some inputs
or
> tips about this.
>
> Best regards.
>
> BP.
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4