CFLib.org – Common Function Library Project

IsSecureSite([localServers])

Last updated February 17, 2004
Download UDF

author

Mike Hughes                                       Mike Hughes

Version: 1 | Requires: ColdFusion 5 | 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:

<cfscript>
/**
* 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;
}
</cfscript>

Search CFLib.org


Latest Additions

Jose Diaz-Salcedo Jose Diaz-Salcedo added
cfRssFeed
2 day(s) ago

Raymond Compton Raymond Compton added
structBlend
23 day(s) ago

Duncan Duncan added
IsZIPUK
23 day(s) ago

Todd Sharp Todd Sharp added
getTagContentAll
29 day(s) ago

Gerald Guido Gerald Guido added
ListReturnDuplicat...
1 month(s) ago

Created by Raymond Camden / Design by Justin Johnson