Open GoogleCodeExporter opened 8 years ago
if you still need assistance, visit site:
http://www.usaidit.com/?p=254
I believe the individual used classic asp with limited coding for recaptcha.
Original comment by kob...@gmail.com
on 13 Aug 2009 at 7:19
I can't get this to work with ASP at all (I'm a nube) - I've read:
http://www.google.co.uk/url?sa=t&source=web&cd=2&ved=0CCMQFjAB&url=http%3A%2F%2F
www.captcha.net%2F&ei=k18sTLeyJo-WsQbe3a26Ag&usg=AFQjCNGCzSZAYOAGJ-RnHlt9tDk43MU
8Ag&sig2=xj4mIS4yH0eAjCwhPtJbCA
http://groups.google.com/group/recaptcha/msg/187b6f7a32f4cbe4
and
http://wiki.recaptcha.net/index.php/Overview#Classic_ASP
the latter seemed the most promising, but it didn't work either...
methinks some server side installation is neccessary...
best find a simpler solution!!
Original comment by my1stmon...@gmail.com
on 1 Jul 2010 at 9:45
1. Save the following code as recaptcha.asp.
<%
recaptcha_challenge_field = Request("recaptcha_challenge_field")
recaptcha_response_field = Request("recaptcha_response_field")
recaptcha_public_key = "your public key"
recaptcha_private_key = "your private key"
' returns the HTML for the widget
function recaptcha_challenge_writer()
recaptcha_challenge_writer = _
"<div class='row1'>Please enter the following text in the Captcha field:</div>" & _
"<div class='row2'>" & _
"<script type=""text/javascript"">" & _
"var RecaptchaOptions = {" & _
" theme : 'clean'," & _
" tabindex : 0" & _
"};" & _
"</script>" & _
"<script type=""text/javascript"" src=""https://www.google.com/recaptcha/api/challenge?k=" & recaptcha_public_key & """></script>" & _
"<noscript>" & _
"<iframe src=""https://www.google.com/recaptcha/api/noscript?k=" & recaptcha_public_key & """ frameborder=""1""></iframe><>" & _
"<textarea name=""recaptcha_challenge_field"" id=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _
"<input type=""hidden"" name=""recaptcha_response_field"" id=""recaptcha_response_field"" value=""manual_challenge"">" & _
"</noscript>" & _
"</div>"
'"<script type=""text/javascript""
src=""https://api-secure.recaptcha.net/challenge?k=" & recaptcha_public_key &
"""></script>" & _
end function
' returns "" if correct, otherwise it returns the error response
function recaptcha_confirm(rechallenge,reresponse)
Dim VarString
VarString = _
"privatekey=" & recaptcha_private_key & _
"&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _
"&challenge=" & rechallenge & _
"&response=" & reresponse
Dim objXmlHttp
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.open "POST", "http://www.google.com/recaptcha/api/verify", False
objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXmlHttp.send VarString
Dim ResponseString
ResponseString = split(objXmlHttp.responseText, vblf)
Set objXmlHttp = Nothing
if ResponseString(0) = "true" then
'They answered correctly
recaptcha_confirm = ""
else
'They answered incorrectly
recaptcha_confirm = ResponseString(1)
end if
end function
recaptcha_response_field)
%>
2. include recaptcha.asp at the top of the form.asp.
<!--#include file="recaptcha.asp"-->
3. add the following at the end of your form
<%
if server_response <> "" or newCaptcha then
if newCaptcha = False then
response.write "<!-- An error occurred --> Wrong!"
end if
response.write recaptcha_challenge_writer()
else
response.write "<!-- The solution was correct --> Correct!"
end if
%>
4. in the form handler add the following code
if server_response <> "" or newCaptcha then
response.write "Please enter the words shown in the reCeptcha field."
response.write "<p><a href='javascript:history.go(-1);'>Go back</a></p>"
else
newCaptcha = False
' collect your form data here
end if
Original comment by kami.b...@gmail.com
on 17 Apr 2012 at 3:06
Original issue reported on code.google.com by
wasa...@gmail.com
on 12 Mar 2009 at 3:06