This is not proper CFML syntax: <cfif id="userInput" eq Hash(#form.userInput#)>
What are you trying to do exactly in this line? I think you meant: <cfif hash(form.userinput) eq form.hashval> We want to compare the hidden form field, form.hashval, which was a hash of the captcha, with a hash of what the user entered. On Tue, Mar 22, 2011 at 4:55 PM, John Barrett <[email protected]> wrote: > > Hi, > > thanks so much for your help! > I tried(see below) but I get a error for the "=" > > this is just 1 page called image_text.cfm > > <!---code ---> > > <cfif ("form.submit")> > > <cfif id="userInput" eq Hash(#form.userInput#)> > <cfoutput> > you got it! > </cfoutput> > </cfif> > <cfelse> > > <!--- Set the length of the text string for the CAPTCHA image. ---> > <cfset stringLength=6> > <!--- Specify the list of characters used for the random text string. The > following list > limits the confusion between upper- and lowercase letters as well as between > numbers and > letters. ---> > <cfset > stringList="2,3,4,5,6,7,8,9,a,b,d,e,f,g,h,j,n,q,r,t,y,A,B,C,D,E,F,G,H,K,L,M,N,P,Q,R,S, > T,U,V,W,X,Y,Z"> > <cfset rndString=""> > <!--- Create a loop that builds the string from the random characters. ---> > <cfloop from="1" to="#stringLength#" index="i"> > <cfset rndNum=RandRange(1,listLen(stringList))> > <cfset rndString=rndString & listGetAt(stringList,rndNum)> > </cfloop> > <!--- Hash the random string. ---> > <cfset rndHash=Hash(rndString)> > > <!--- Create the user entry form. ---><body id="userInput" name="userInput"> > <cfform action="image_test.cfm" method="post" name="userInput" id="userInput"> > > <!--- Use the randomly generated text string for the CAPTCHA image. ---> > <p><cfimage action="captcha" fontSize="16" fonts="Times New Roman" > width="215" height="50" > text="#rndString#"></p> > <p>Please type what you see: </p> > <p><cfinput type="text" name="userInput" required="yes"> > <cfinput type="hidden" name="hashVal" value="#rndHash#"> > <p><cfinput type="Submit" name ="OK" value="OK"></p> > > </cfform> > > <p>I'm sorry; please try again.</p> > > </cfif> > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5260 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
