CFLib.org – Common Function Library Project

IsSecureSite([localServers])

Last updated February 17, 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;
}
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