Listing 3
<cfparam name="request.dumpMode" default="" type="string"> <cfparam name="request.emailTo" default="" type="string"> <cfparam name="request.emailFrom" default="" type="string"> <cfparam name="request.emailServer" default="" type="string"> <cflock scope="SERVER" type="READONLY" timeout="10"> <cfset variables.CFVer=Left(server.coldfusion.ProductVersion,1)> </cflock> <cfscript> request.vars="CFCATCH,ERROR,APPLICATION,ATTRIBUTES,CALLER,CGI, CLIENT,FORM,REQUEST,SESSION,THIS,THISTAG,URL,VARIABLES"; request.theFileName=Replace(CreateUUID(),"-","","all"); request.errorDirectory="c:/cfusionmx/wwwroot/myerrors/"; request.errorDomain="https://www.mydomain.com/errors/"; variables.Security="<variables.PageStatus=""1"">" & chr(10); variables.Security=variables.Security & "<cfinclude template=""inc_logincheck.cfm"">" & chr(10); </cfscript> <cffile action="write" file="#request.errorDirectory##request.theFileName#.cfm" output="#variables.Security#" addnewline="Yes"> <cfsavecontent variable="variables.dataDump"> <cfloop list="#request.vars#" index="loopItem"> <cfif IsDefined("#loopItem#")> <cfif Compare(variables.CFVer,6)> <br><br><cfoutput><b>#loopItem#</b></cfoutput> </cfif> <cfdump var="#Evaluate(loopItem)#" label="#loopItem#"> </cfif> </cfloop> </cfsavecontent> <cffile action="write" file="#request.errorDirectory##request.theFileName#.cfm" output="#variables.dataDump#" addnewline="Yes"> <cfswitch expression="#request.dumpMode#"> <cfcase value="STANDARD"> <cfmail to="#request.emailTo#" from="#request.emailFrom#" subject="#cgi.server_name# Error" server="#request.emailServer#" type="HTML" mimeattach="#request.errorDirectory##request.theFileName#.cfm"> <p> <a href="#request.errorDomain#list.cfm"> See complete error list </a> </p> </cfmail> </cfcase> <cfcase value="SECURE"> <cfmail to="#request.emailTo#" from="#request.emailFrom#" subject="#cgi.server_name# Error" server="#request.emailServer#" type="HTML"> <p> <a href="#request.errorDomain##request.theFileName#.cfm"> See It </a> </p> <p> <a href="#request.errorDomain#list.cfm"> See complete error list </a> </p> </cfmail> </cfcase> <cfcase value="ONSCREEN"> <cfoutput> #variables.dataDump# </cfoutput> </cfcase> </cfswitch>
|