"Virtual Arachnophobia" Vol. 2,Issue 1,
p.36

Listing 1:

<!--- Find the end of the protocol --->
<CFSET URLStart = (FindNoCase("//",CGI.QUERY_STRING))>
<CFIF URLStart IS NOT 0>
   <!--- Remove information before the URL --->
   <CFSET Target = RemoveChars(CGI.QUERY_STRING, 1, (URLStart -1))>
<CFELSE>
   <!--- This will force standard processing --->
   <CFSET Target="Could not parse">
</CFIF>
<CFIF FindNoCase(".html",Target) EQ 0>
   <HTML>
   <HEAD>
   <TITLE>Error 404</TITLE>
   </HEAD>
   <BODY>
   <!--- Error Message --->
   <H1>ERROR: The requested page could not be found.</H1>
   </BODY>
   </HTML>
<CFELSE>
   <CFSET CFMTarget = Replace(Target,".html",".cfm","ONE")>
   <CFLOCATION URL="#CFMTarget#">
</CFIF>

Listing 2:

<!--- Find the end of the protocol --->
<CFSET URLStart = (FindNoCase("//",CGI.QUERY_STRING))>
<CFIF URLStart IS NOT 0>
   <!--- Remove information before the URL --->
   <CFSET Target = RemoveChars(CGI.QUERY_STRING, 1, (URLStart -1))>
<CFELSE>
   <!--- This will force standard processing --->
   <CFSET Target="Could not parse">
</CFIF>
 

<!--- Check for dynamic course info code --->
<CFSET DynamicStart = FindNoCase("DYN_",Target)>
<CFIF DynamicStart IS NOT 0>
   <CFSET DynamicStart = DynamicStart + 4>
   <CFSET DynamicEnd = FindNoCase(".",Target,DynamicStart)>
   <CFSET Target = Mid(Target,DynamicStart,(DynamicEnd - DynamicStart))>
   <CFLOCATION URL="CourseInfo.cfm?URL.COURSE_ID=#Target#">
   <CFEXIT>
</CFIF>
 

<CFIF FindNoCase(".html",Target) EQ 0>
   <HTML>
   <HEAD>
   <TITLE>Error 404</TITLE>
   </HEAD>
   <BODY>
   <!--- Error Message --->
   <H1>ERROR: The requested page could not be found.</H1>
   </BODY>
   </HTML>
<CFELSE>
   <CFSET CFMTarget = Replace(Target,".html",".cfm","ONE")>
   <CFLOCATION URL="#CFMTarget#">
</CFIF>
 

Listing 3:

<!--- Find the end of the protocol --->
<CFSET URLStart = (FindNoCase("//",CGI.QUERY_STRING))>
<CFIF URLStart IS NOT 0>
   <!--- Remove information before the URL --->
   <CFSET Target = RemoveChars(CGI.QUERY_STRING, 1, (URLStart -1))>
<CFELSE>
   <!--- This will force standard processing --->
 

   <CFSET Target="Could not parse">
</CFIF>
 

<!--- Check for dynamic course info code --->
<CFSET DynamicStart = FindNoCase("DYN_",Target)>
<CFIF DynamicStart IS NOT 0>
   <CFSET DynamicStart = DynamicStart + 4>
   <CFSET DynamicEnd = FindNoCase(".",Target,DynamicStart)>
   <CFSET Target = Mid(Target,DynamicStart,(DynamicEnd - DynamicStart))>
   <CFINCLUDE TEMPLATE="CourseInfo.cfm?COURSE_ID=#Target#">
   <CFEXIT>
</CFIF>
 

<CFIF FindNoCase(".html",Target) EQ 0>
   <HTML>
   <HEAD>
   <TITLE>Error 404</TITLE>
   </HEAD>
   <BODY>
   <!--- Error Message --->
   <H1>ERROR: The requested page could not be found.</H1>
   </BODY>
   </HTML>
<CFELSE>
   <CFSET CFMTarget = Replace(Target,".html",".cfm","ONE")>
   <CFLOCATION URL="#CFMTarget#">
</CFIF>

Listing 4:

<!--- Find the end of the protocol --->
<CFSET URLStart = (FindNoCase("//",CGI.QUERY_STRING))>
<CFIF URLStart IS NOT 0>
   <!--- Remove information before the URL --->
   <CFSET Target = RemoveChars(CGI.QUERY_STRING, 1, (URLStart -1))>
<CFELSE>
   <!--- This will force standard processing --->
   <CFSET Target="Could not parse">
</CFIF>
 

<!--- Check for dynamic course info code --->
<CFSET DynamicStart = FindNoCase("DYN_",Target)>
<CFIF DynamicStart IS NOT 0>
   <CFSET DynamicStart = DynamicStart + 4>
   <CFSET DynamicEnd = FindNoCase(".",Target,DynamicStart)>
   <CFSET Target = Mid(Target,DynamicStart,(DynamicEnd - DynamicStart))>
   <CFSET URL.COURSE_ID = "#Target#">
   <CFINCLUDE TEMPLATE="CourseInfo.cfm">
   <CFEXIT>
</CFIF>
 

<CFIF FindNoCase(".html",Target) EQ 0>
   <HTML>
   <HEAD>
   <TITLE>Error 404</TITLE>
   </HEAD>
   <BODY>
   <!--- Error Message --->
   <H1>ERROR: The requested page could not be found.</H1>
   </BODY>
   </HTML>
<CFELSE>
   <CFSET CFMTarget = Replace(Target,".html",".cfm","ONE")>
   <CFLOCATION URL="#CFMTarget#">
</CFIF>