You need to remember the last time the user hit the page. One idea - use a
onRequestEndTemplate and store the current time in a structure. Use the
username as a key so your structure looks like:

LastHit["moprheus"] = timeX
Lasthit["jedi"] = someothertime

Also, see this code:

> <cfif NOT IsDefined('Application.Users')>
>   <cfset Application.Users = StructNew()>
> </cfif>

You need to add CFLOCKs around it. I'd suggest rewriting it like so:

<CFLOCK SCOPE="Application" TYPE="ReadOnly" TIMEOUT=30>
        <CFSET NeedIt = True>
        <CFIF IsDefined("Application.Users")>
                <CFSET NeedIt = False>
        </CFIF>
</CFLOCK>
<CFIF NeedIt>
        <CFLOCK SCOPE="Application" TYPE="Exclusive" TIMEOUT=30>
                <CFSET Application.Users = StructNew()>
        </CFLOCK>
</CFIF>

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : [EMAIL PROTECTED]
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: Chris Phillips [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 22, 2001 7:44 AM
> To: CF-Talk
> Subject: help with structures and deleting their contents
>
>
> Hi all
>
> I'm new to structures and am working on a piece of code that is
> supposed to
> display all users logged into a system at any given moment. The display
> works fine, and outputs the results of the created structure no problem.
>
> I have some code that takes the user to a logout page where their
> structure
> is deleted - but what happens <g> when they don't log out - I
> want to delete
> their structure after a set time, in this case 10 mins (will be
> set later in
> development)
>
> What I can't get it to do is to delete the structure / content
> after 10 mins
> - I have an if statement saying if 13 is greater than 10 (for
> example) then
> delete it - but it won't ... aaargh
>
> Can s/o please have a look and see what I am doing wrong
>
> Many thanks
>
> Chris
>
> ================================
> chris phillips
> communisis one plc, leeds, uk
> ================================
>
>
> <!--- on page after checking login against the db --->
>
> <!--- check whether structure is there for them or not --->
> <cfif NOT IsDefined('Application.Users')>
>   <cfset Application.Users = StructNew()>
> </cfif>
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to