CFLib.org – Common Function Library Project

URLHash(URLValue)

Last updated January 7, 2002

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

 
Rated 4 time(s). Average Rating: 4.5

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:

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

view plain print about
<cfscript>
/**
 * 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));
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

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

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

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

Ben Forta Ben Forta added
GetHostAddress
22 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