CFLib.org – Common Function Library Project

IsSecureSite([localServers])

Last updated February 18, 2004

author

Mike Hughes

Version: 1 | Requires: CF5 | Library: SecurityLib

Description:
It checks to see if the code is on a SSL site by checking the value of CGI.Server_Port_Secure. You can also pass a list of servers to the UDF so you can use your code on a listed sever, local and development servers.

Return Values:
Returns a boolean.

Example:

<cfif NOT IsSecureSite("localhost,gne550d")>
    <cflocation url="#Request.WebPath.SecureDomain#index.cfm">            
</cfif>

Parameters:

Name Description Required
localServers If the current server matches one of the servers in this list, the UDF will return true. Defaults to an empty string. No

Full UDF Source:

/**
 * Checks to see if the current page is being run on a secure server.
 * 
 * @param localServers      If the current server matches one of the servers in this list, the UDF will return true. Defaults to an empty string. (Optional)
 * @return Returns a boolean. 
 * @author Mike Hughes (mike@gne-ws.com) 
 * @version 1, February 17, 2004 
 */
function IsSecureSite() {
    if(arrayLen(arguments)) localServers = arguments[1]; 
    if(cgi.server_port_secure OR listFindNoCase(localServers, cgi.server_name)) 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