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>

<!--- create a unique session ID for them --->
<CFLOCK TIMEOUT="5" THROWONTIMEOUT="No" TYPE="EXCLUSIVE" SCOPE="SESSION">
  <cfscript>
    Session.UserID = CreateUUID() ;
        
    newUser = StructNew() ;
    newuser.UserName = Attributes.UserName ;
    newUser.LoggedIn = Now() ;
    newUser.LastAccess = Now() ;
    newUser.ClientID = Attributes.ClientID ;
            
    Application.Users[Session.UserID] = StructCopy(newUser) ; 
  </cfscript>
</cflock>



<!--- and then on the display page (for test purposes) where I am outputting
all the structures and their info --->
        
<!--- loop through the structures --->

<cfloop item="user" collection="#Application.Users#">

<cfset vTimetogo = "#DateDiff("n", Application.Users[user].lastAccess,
Now())#">

<!--- see what the figure is for my sanity --->
<cfoutput>#vTimetogo# mins</cfoutput><br>

<cfif vTimetogo GT 10>

<!--- check if loop is working --->
output a test text 

<!--- THE BIT THAT DOESN'T WORK ... IT DOES NOT DELETE THE STRUCTURE /
CONTENTS --->
    <cfscript>
        StructDelete(Application.Users[user], user) ;
        </cfscript>
 </cfif> 
</cfloop>  

<!--- bit of code that outputs the structure content in detail and a list of
users logged on --->

<!--- THEN USE CF_OBJECTDUMP to see what is there --->


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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