PDA

View Full Version : Edit Code for Captcha (open-source) help?



Seng
10-11-2007, 07:30 AM
Hey guys,

I've found a free open-source captcha to be employed in my registration form. However, I don't know how to implement the captcha's validation in my registration form itself!

More info:
My asp registration form used javascript for validation. Once the user has filled all the required fills and pressed the 'submit' button, the data will be inserted to the database. So how do I implement Captcha's validation on the form itself?

This is the captcha's validation code the site gave me, they said it's to be entered into another .asp page which I don't want:
-----------------------
strCAPTCHA = Trim(Request.Form("strCAPTCHA"))
if strCAPTCHA = Trim(Session("CAPTCHA_" & Session.SessionID)) then
else
ErrorMessage = ErrorMessage & Server.URLEncode("You did not type in the verification info correctly.\n\n")
End If
-----------------------

Here's the official site and the 'how-to' section:
TipsTricks (http://www.tipstricks.org/howto_1.htm)

Twey
10-11-2007, 08:24 AM
You don't. ASP is server-side: it isn't part of the frontend (in this case the form). You need to make it part of your server-side validation script, on the page to which the form submits.

Seng
10-11-2007, 08:46 AM
Hmm... ok, thanks for the reply~

Ouch!
Then is there a way to convert the 'errormessage' to something like Javascript's "return false"?

Twey
10-11-2007, 09:11 AM
No. It's possible to do something with XMLHttpRequest. Are you using this already, or do you have duplicate code on the front- and back-ends?

Seng
10-11-2007, 09:40 AM
No, I have not used it yet.

May I know what is it and how to use it?

Seng
10-11-2007, 01:29 PM
Oh wait, I've already found a solution.

Thanks!