Hi,
Im having trouble creating a basic timer that throws users
out to the logout
page after a certain amount of inactivity, Its set to one
minute at the
moment. I want to place this code on the top of certain
pages. Im having all
sorts of trouble with the conditional code and the functions.
At the moment the page executes but my conditional code is
ignored. I cant
seem to validate the client.timeout variable. I've tried the
isDate
function that also hasnt worked for me. The logic is that
when users request
a page the timeout variable is compared to the current time.
Can anyone help please.
<!----See if the client variable had been set from a
previous load of the
page---->
<cfif isDefined("client.timeout")>
<!-----If variable isdefined calculate how long since
users last
activity----->
<cfif datecompare(client.timeout, now(), n) EQ -1>
send away to logout page and kill cfid and cftoken
cookie<cfabort>
<cfelse>
keep the user active
</cfif>
</cfif>
<cfset countdown=#CreateODBCDateTime(now())#>
<cfset client.timeout= #countdown# + #CreateTimeSpan(0, 0,
1, 0)#>
<cfset client.timeout=
#CreateODBCDateTime(client.timeout)#>
<!------Test Output----->
<cfoutput>#countdown#</cfoutput><br />
<cfoutput>#client.timeout#</cfoutput><br />
<cfoutput>#datediff("n", client.timeout, countdown)#
</cfoutput>