Quick CF debugging switcher
If you're like me, you turn debugging on/off often on your development box. I got tired of going into the CFAdmin to do this, so I built a little script that lets me put in my CF Admin password, and then toggle the debugging output.
The only weird thing is that if you turn debugging on, it doesn't show on this page immediately, but it will show up after a page refresh. I thought other people might find this useful:
<form name="debugSwitch" method="post">
<input type="password" name="pwd" id="pwd" size="8">
<input type="submit" name="submit" value="On">
<input type="submit" name="submit" value="Off">
</form>
<cfif structKeyExists(form,"submit")>
<cfparam name="form.submit" default="">
<cfif form.submit eq "On">
<cfset debugToggle = 1>
<cfelse>
<cfset debugToggle = 0>
</cfif>
<cftry>
<cfscript>
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login(form.pwd);
myObj = createObject("component","cfide.adminapi.debugging");
myObj.setDebugProperty("enableDebug",debugToggle);
<cfif form.submit eq "On">
myObj.setIP(cgi.remote_addr);
<cfelse>
myObj.deleteIP(cgi.remote_addr);
</cfif>
</cfscript>
<cfcatch type="cfadminapiSecurityError">
Couldn't log you in...please try again
</cfcatch>
</cftry>
</cfif>
</body>
Also, I think this is a perfect example of where frameworks/OO do not make sense. Oh, and please don't put this in a public location, and make sure your CF admin password is strong. ;)
Jake Munson
36 Yrs old
javascript:(function(){var debug=window.open('http://localhost/debugFlip.cfm?debug=off');debug.close();})()
javascript:(function(){var debug=window.open('http://localhost/debugFlip.cfm?debug=on');debug.close();})()
Code change should be obvious enough, and with the password hardcoded it's that much faster.
javascript:(function(){var debug=window.open('http/link/to/debugFlip.cfm?debug=off');debug.close();})()