CFLib.org – Common Function Library Project

URLHash(URLValue)

Last updated January 7, 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));
}
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