CFLib.org – Common Function Library Project

IsClientTimeout(timespan)

Last updated August 09, 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;
  }
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson