CFLib.org – Common Function Library Project

stripURLToken(x)

Last updated February 23, 2009

author

David Grant

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Supply a string and the string is returned with the URL token removed (cfid=2322&cftoken=1243934978). ? or & is accounted for, as well as any combination of upper/lower case text. Useful when you just want the URL and simple parameters, excluding session information. Updated: Jason Bartholme added jsession variables

Return Values:
Returns a string.

Example:

<cfscript>
thisAddress = cgi.script_name & "?" & cgi.query_string;
thisAddress = stripURLToken(variables.thisAddress);
</cfscript>

<!--- session info will be stripped off --->
<cfoutput>#variables.thisAddress#</cfoutput>

Parameters:

Name Description Required
x String to modify. Yes

Full UDF Source:

/**
 * Strips the cfid/cftoken information from a string.
 * Updated: Jason Bartholme
 * added jsession variables
 * 
 * @param x 	 String to modify. (Required)
 * @return Returns a string. 
 * @author David Grant (x@seizethedave.com) 
 * @version 1, February 23, 2009 
 */
function stripURLToken (x) {
return REReplace(x, "(\?|&)([Cc][Ff][Ii][Dd]|[Cc][Ff][Tt][Oo][Kk][Ee][Nn]|[Jj][Ss][Ee][Ss][Ss][Ii][Oo][Nn][Ii][Dd])=[\s\S]+", "", "ALL");
}
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