Bare Bones example of the LylaCaptcha
Here is a quick, dirty and bare bones example of the LylaCaptcha using the stream method. This is for my own notes, but if you find it handy you are welcome to it. This example is very highly based on Brian Rinaldi Ajax example (just sans Ajax and it does not use the file method):
http://www.remotesynthesis.com/blog/index.cfm/2006/6/21/Validating-CAPTCHA-with-AJAX
http://coldfusion.sys-con.com/read/236003.htm
A few items of note:
-The stream method requires CF7.
-LylaCaptcha should be init'ed into a persistent scope (Application scope) Or else the hashes will not match.
-The form page assumes captchaimg.cfm is the Captcha generation page.
-All paths assume this example is in the "captcha" folder. (Not a good idea to do this in production.)
-All three files below AND LylaCaptcha are required for this example to work.
Here is the code:
Application.cfm:
<cfapplication name="LylaCaptchaApp">
<cfparam name="url.reinit" default="false">
<!--- initalize the LylaCaptcha--->
<cfif not structKeyExists(application,"captcha") or url.reinit>
<cfset application.captcha = CreateObject("component","captchaService").init(configFile="captcha.xml") />
<cfset application.captcha.setup() />
</cfif>
form.cfm:
<!--- If form is submitted validate Captcha hash and user input--->
<cfif isdefined("form.fieldnames") >
Captcha Valid:<cfdump var="#application.captcha.validateCaptcha(form.captchaHash,ucase(form.captchaText))#">
</cfif>
<!--- Build Hash to pass to the image file and to pass in the hidden form field--->
<cfset variables.captcha = application.captcha.createHashReference() />
<html>
<body>
<cfoutput>
<form method="post" action="#GetFileFromPath(cgi.script_name)#">
<!--- call image file. Send Hash --->
<img src="captchaimg.cfm?hashReference=#variables.captcha.HASH#" />
<!--- Input text box for user input --->
<input type="text" name="captchaText" size="6" value=""/>
<!--- Hidden Input text box for hash --->
<input type="hidden" name="captchaHash" value="#variables.captcha.hash#" />
<input Type="submit" name="go" value="go">
</form>
</cfoutput>
</body>
</html>
captchaimg.cfm:
<cfset variables.captcha = application.captcha.createCaptchaFromHashReference("stream",url.hashReference) />
<cfcontent type="image/jpg" variable="#variables.captcha.stream#" reset="false" />

Doh, egg on my face.... I had a random '<' in the attribuite action of the form.
Thanks for finding that. Code above has been updated.
First can you confirm the version of CF you are running on your webserver?
MB
http://www.dervishmoose.com/blog/index.cfm/2006/3/...
Seems to me heard about the ColdFusion MX 7 Updater 2 (7.0.2)fixing the issue. At least a good idea to start with asking you hosting provider to upgrade.
Sorry I could not be more help.
As it is my understaning your issue happened when they applied the fix and had to rollback in order to fix the issue. Is that correct?
My host company shows version 7,0,1,116466 which would mean that they have not applied the hotfix yet. So applying the hotfix would create more issues than less. Am i correct in this assumption? Sorry to drag this out just trying to understand the issue.
Better check Adobes site (help fourm)
Sorry I could not be more help.
MB
http://www.aigaphilly.org/captimg/test03/form.cfm
It's giving me a "Variable IsXML is undefined." error? Does that look familiar?
Also, if you don't have version 7 you can not use the stream method (as in my example) for displaying the image.
You will have to use the file medthod assuming LylaCAPTCHA (see link) will run on CFMX 6. I can not find any info to say if it will or if it will not.
http://lyla.maestropublishing.com/FAQ.cfm#15
http://www.britany-spears.150m.com/britany-spears.... , Cool site!
Can anyone please specify that LylaCaptcha works on ColdFusion 6.1 or not? I am facing many issues with that.
If it works, it would be great if a step-by-step guide can be provided for beginners like me.
Any help would be highly appreciated.
Thanks and Regards,
Haseeb Khan
interesting site
http://newsblogdirect.com
http://timbei.info