CFLib.org – Common Function Library Project

IsClientTimeout(timespan)

Last updated August 9, 2002

author

Rob Brooks-Bilson

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
Returns True if the user has not requested a page within the given time span. This function can be used to timeout client variables in security schemes where you control access by checking for the existence of a client variable. This gets around a key difference between client and session variables. <P> You must have client state management enabled with the CFAPPLICATION tag in order to use this function.

Return Values:
Returns a Boolean value.

Example:

<!---
Example commented out so that application will not interfere with site.

<CFAPPLICATION NAME="IsClientTimeoutTest" CLIENTMANAGEMENT="Yes" sessionmanagement=1 CLIENTSTORAGE="Cookie">

<CFIF IsClientTimeout(CreateTimeSpan(0,0,30,0))>
  <CFSET Client.LoggedIn = False>              
</CFIF>
--->

Parameters:

Name Description Required
timespan Days, hours, minutes, and seconds (using CreateTimeSpan) before client variables should be timed out. Yes

Full UDF Source:

/**
 * Returns True if the user has not requested a page within the given time span.
 * 
 * @param timespan 	 Days, hours, minutes, and seconds (using CreateTimeSpan) before client variables should be timed out. (Required)
 * @return Returns a Boolean value. 
 * @author Rob Brooks-Bilson (rbils@amkor.com) 
 * @version 1, August 9, 2002 
 */
function IsClientTimeout(timespan)
{
  if (DateCompare(CreateODBCDateTime(Now()), DateAdd("s", (Round(timespan* 86400)), Client.LastVisit)) GTE 0){ 
    Return True;
  }
  else{
    Return False;
  }
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson