CFLib.org – Common Function Library Project

URLHash(URLValue)

Last updated January 07, 2002

author

John Bartlett

Version: 1 | Requires: CF5 | Library: SecurityLib

Description:
This function generates a Hash value based off of the full URL including any URL variables and the remote user's IP address. You can use the URLCheckHash UDF to determine if the URL was changed.

Return Values:
Returns a string.

Example:

<cfset x = 2>
<cfset urlData="id=#X#&mode=display">
<cfoutput>
Hashed URL is:<br>
display.cfm?#URLHash(urlData)#
</cfoutput>

Parameters:

Name Description Required
URLValue The string to hash. Yes

Full UDF Source:

/**
 * URL Security tool to prevent a user from changing any part of a URL.
 * 
 * @param URLValue      The string to hash. 
 * @return Returns a string. 
 * @author John Bartlett (jbartlett@strangejourney.com) 
 * @version 1, January 7, 2002 
 */
function URLHash(URLValue)
{
  var HashData =cgi.Server_Name & cgi.Remote_Addr & cgi.Script_Name & URLValue;
  return URLValue & "&hash=" & LCase(Hash(HashData));
}

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