Try this:
This snippet goes in our application.cfm:

<cflock scope="APPLICATION" timeout="10" type="EXCLUSIVE">
        <cfif NOT IsDefined("application.EmployeeUsers")>
                <cfscript>application.EmployeeUsers =
StructNew();</cfscript>
        </cfif>
        
        <cfif session.UserID GT 0>
                <cfif StructKeyExists(application.EmployeeUsers,
"#session.UserID#")>
        
<cfoutput><cfscript>StructUpdate(application.EmployeeUsers,
"#session.UserID#", "#Now()#, #cgi.Remote_Addr#");</cfscript></cfoutput>
                <cfelse>
        
<cfoutput><cfscript>StructInsert(application.EmployeeUsers,
"#session.UserID#", "#Now()#, #cgi.Remote_Addr#");</cfscript></cfoutput>
                </cfif>
        </cfif>
</cflock>


Here's what we do to display them in a file we call userViewer.cfm:
<cfif ListLen(StructKeyList(application.EmployeeUsers)) GT 0>
        <cfquery name="EmployeeUsers" datasource="#application.ds#">
                SELECT EmployeeID, FullName AS UserName, UserType,
CustomerLocationName AS Location
                FROM Employees (NOLOCK)
                        INNER JOIN tblCustomerLocations (NOLOCK) ON
Employees.CustomerLocationID = tblCustomerLocations.CustomerLocationID
                        LEFT OUTER JOIN tblUserType (NOLOCK) ON
Employees.[Group] = tblUserType.UserTypeID
                WHERE EmployeeID IN
(#StructKeyList(application.EmployeeUsers)#)
                ORDER BY UserName       
        </cfquery>

        <cfoutput query="EmployeeUsers">
                ...  Blah blah blah...
        </cfoutput>
</cfif>



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 29, 2002 1:24 PM
To: CF-Talk
Subject: Using Coldfusion for Personalization ???


Hi 

I would be very gratefull if somebody on the list could give me some 
help/tips on how to achieve the following in coldfusion please.

Basically all I need is a way to tell when users are online and when they
are not. 

I know how to tell when they first get there but the leaving part is where I

get stuck... Look at: http://www.gnutella.com/users/online and thats what I 
want to do in ColdFusion.

Any help would be very much appreciated

Thanks

Ian 
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to