CFLib.org – Common Function Library Project

IsSecureSite([localServers])

Last updated February 17, 2004

Version: 1 | Requires: ColdFusion 5 | Library: SecurityLib

 
Rated 0 time(s). Average Rating: 0

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:

view plain print about
<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:

view plain print about
<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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
29 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson