Tuesday, April 12, 2005

Coldfusion and CGI Variables

Anyone know where I can get a list of all CGI.- variables?

<cfdump var=#cgi#>

Below is code I use if I need to know a CGI value is for a given browser/etc. It also saves the data to a text file on the server so that if you're browsing via a cell phone/PDA, you can still easily pull up the information in your browser.

<cfset c=Chr(10)>

<cfset Out=
"CF: #Server.ColdFusion.ProductVersion#" & c &
"OS: [#Server.OS.Name#]" & c &
"OS Ver: [#Server.OS.Version#]" & c>

<cfset KeyList=StructKeyList(CGI)>
<cfloop index="Key" list="#KeyList#">
<cfset CVal=Evaluate("CGI.#Key#")>
<cfset Out=Out & "#Key#: [#CVal#]" & c>
</cfloop>

<cfoutput><pre>#Out#</pre></cfoutput>

<cffile action="WRITE" file="#GetDirectoryFromPath(GetCurrentTemplatePath())#cgi.txt" output="#Out#" addnewline="No">

0 Comments:

Post a Comment

<< Home