Re: Help with CAPTCHA on a classic .ASP form

824 views
Skip to first unread message

Mark Windsor

unread,
Mar 25, 2013, 9:11:50 AM3/25/13
to reca...@googlegroups.com
I have the exact same issue - 

entered the code up top and placed the needed code in the area where I want the capcha to be seen.

ISSUE: I can fill out the form and submit with success without touching the capcha?
Did you get a response?

This is my page

Mark




On Thursday, 21 March 2013 13:32:08 UTC-4, Mike Hilll wrote:
Hello,
 
I have inserted the code to my form and the captcha box shows up great.
However, if you don't fill out the captcha form it will still take you to the success page.
 
In other words, the captcha box is visible but does not work.
Could anyone be so kind to help?
 
Below is my code:
 
<%
  recaptcha_challenge_field  = Request("recaptcha_challenge_field")
  recaptcha_response_field   = Request("recaptcha_response_field")
  recaptcha_public_key       = "6Lfxf94SAAAAAHmtIqAaBJGKt5KuXNPHZ0qLGBlQ" ' your public key
  recaptcha_private_key      = "6Lfxf94SAAAAAIO8AyNEtZ93YFxE6gcePkSH1Dyb" ' your private key
  ' returns the HTML for the widget
  function recaptcha_challenge_writer()
  recaptcha_challenge_writer = _
  "<script type=""text/javascript"">" & _
  "var RecaptchaOptions = {" & _
  "   theme : 'red'," & _
  "   tabindex : 0" & _
  "};" & _
  "</script>" & _
  "<script type=""text/javascript"" src=""http://www.google.com/recaptcha/api/challenge?k=" & recaptcha_public_key & """></script>" & _
  "<noscript>" & _
    "<iframe src=""http://www.google.com/recaptcha/api/noscript?k=" & recaptcha_public_key & """ frameborder=""1""></iframe><>" & _
      "<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _
      "<input type=""hidden"" name=""recaptcha_response_field""value=""manual_challenge"">" & _
  "</noscript>"
  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
  server_response = ""
  newCaptcha = True
  if (recaptcha_challenge_field <> "" or recaptcha_response_field <> "") then
    server_response = recaptcha_confirm(recaptcha_challenge_field, recaptcha_response_field)
    newCaptcha = False
  end if
  %>
 
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <title>InfoMart - Background Screening - Get Started</title>
 <META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
 <link href="../infomart.css" rel="stylesheet" type="text/css">
 <script type="text/javascript" src="../includes/mm2scripts.js"></script>
 <script type="text/javascript" src="../includes/mouseover.js"></script>
   
    
</head>
<BODY BGCOLOR="#FFFFFF" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" onLoad="P7_setMM2('none',1,2,'none','none');P7_trigMM2()">
<!--#include virtual="/includes/header.htm"-->
<!--#include virtual="/includes/navigation.htm"-->
<TABLE WIDTH=775 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<!--gutter--><TD WIDTH=15><IMG SRC="../images/spacer.gif" HEIGHT=1 WIDTH=15></TD><!--gutter-->
<!--left side column--> 
<TD WIDTH=140 VALIGN=TOP>
<BR><BR><BR><BR>
<!--put side column content here-->
</TD>
<!--left side column-->
<!--gutter--><TD WIDTH=10><IMG SRC="../images/spacer.gif" HEIGHT=1 WIDTH=10></TD><!--gutter-->
<!--content column-->
<TD VALIGN=TOP>
<IMG SRC="../images/header-getstarted.gif" ALT="Get Started"><BR>
<DIV CLASS="bodytext">
<B>Get the Whole Story</B> on your applicants today!  Complete the form below, and an InfoMart sales representative will contact you to implement a screening program for your company. Or reach a sales rep immediately by calling 800.800.3774 option 4.
<P>
(Note: If you are an applicant that has been denied employment, please <A HREF="http://www.infomart-usa.com/consumer/">click here</A> to contact InfoMart. If you are applying for a job, please contact the employer for an online application.)
<P>
<!-- SalesForce Web-to-Lead form -->
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
 
<input type=hidden name="oid" value="00D300000005uOr">
<input type=hidden name="retURL" value="http://www.infomart-usa.com/getstarted/getstarted-thanks.asp">
<!-- SalesForce Web-to-Lead form -->
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements.  Please uncomment   -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail" value="insert email heather">     -->                          
<!--  ----------------------------------------------------------------------  -->
<TABLE BORDER=0>
<TR>
<TD><label for="first_name">First Name</label> <FONT SIZE="1" COLOR="#FF0000">REQUIRED</TD>
<TD><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><input type="hidden" name="fist_name_required"></TD></TD>
</TR>
<TR>
<TD><label for="last_name">Last Name</label> <FONT SIZE="1" COLOR="#FF0000">REQUIRED</TD>
<TD><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /></TD></TD>
</TR>
<TR>
<TD><label for="title">Title</label>:</TD>
<TD><input  id="title" maxlength="40" name="title" size="40" type="text" /></TD>
</TR>
<TR>
<TD><label for="company">Company</label>: <FONT SIZE="1" COLOR="#FF0000">REQUIRED</TD>
<TD><input  id="company" maxlength="40" name="company" size="40" type="text" /></TD>
</TR>
<TR>
<TD><label for="street">Address</label>:</TD>
<TD><textarea name="street" cols="30"></textarea></TD>
</TR>
<TR>
<TD><label for="city">City</label> / <label for="state">State</label> / <label for="zip">Zip</label>:</TD>
<TD><input  id="city" maxlength="40" name="city" size="12" type="text" />, <input  id="state" maxlength="20" name="state" size="2" type="text" /> <input  id="zip" maxlength="20" name="zip" size="9" type="text" /></TD>
</TR>
<TR>
<TD><label for="phone">Phone</label>:  <FONT SIZE="1" COLOR="#FF0000">REQUIRED</TD>
<TD><input  id="phone" maxlength="40" name="phone" size="20" type="text" /></TD>
</TR>
<TR>
<TD><label for="fax">Fax</label>:</TD>
<TD><input  id="fax" maxlength="40" name="fax" size="20" type="text" /></TD>
</TR>
<TR>
<TD><label for="mobile">Mobile/Alt. Phone</label>:</TD>
<TD><input  id="mobile" maxlength="40" name="mobile" size="20" type="text" /></TD>
</TR>
<TR>
<TD><label for="email">Email</label>: <FONT SIZE="1" COLOR="#FF0000">REQUIRED</TD>
<TD><input  id="email" maxlength="80" name="email" size="40" type="text" /></TD>
</TR>
<TR>
<TD><label for="URL">Website</label>:</TD>
<TD><input  id="URL" maxlength="80" name="URL" size="40" type="text" /></TD>
</TR>
<TR>
<TD COLSPAN=2>Current number of employees <FONT SIZE="1" COLOR="#FF0000">REQUIRED <input  id="employees" name="employees" size="5" type="text" value="" /></TD>
</TR>
<TR>
<TD COLSPAN=2>Current number of locations: <input  id="00N30000001MkWu" name="00N30000001MkWu" size="5" type="text" /></TD>
</TR>
<TR>
<TD COLSPAN=2>Projected number of applicants to be screened annually: <input  id="00N30000001MkX5" name="00N30000001MkX5" size="5" type="text" /><BR> <FONT SIZE="1" COLOR="#FF0000">REQUIRED</TD>
</TR>
<TR>
<TD COLSPAN=2><BR>Are you currently screening? <select  id="00N30000001MkX0" name="00N30000001MkX0" title="Currently Screening"><option value="">--Select--</option><option value="Yes">Yes</option>
<option value="No">No</option>
</select></TD>
</TR>
<TR>
<TD COLSPAN=2><BR>If yes, which screens are you currently performing?<BR>
<textarea  id="00N300000036Eu0" name="00N300000036Eu0" rows="2" cols="40" type="text" wrap="soft"></textarea>
</TD>
</TR>
<TR>
<TD COLSPAN=2><BR>Which services are you interested in ordering? (check all that apply)
<P>
<input  id="00N300000036FGW" name="00N300000036FGW" type="checkbox" value="1" /> Criminal history<br>
<input  id="00N300000036FGb" name="00N300000036FGb" type="checkbox" value="1" /> Multi-state criminal history<br>
<input  id="00N300000036FGg" name="00N300000036FGg" type="checkbox" value="1" /> Civil criminal history<br>
<input  id="00N300000036FGh" name="00N300000036FGh" type="checkbox" value="1" /> Previous employment<br>
<input  id="00N300000036FH0" name="00N300000036FH0" type="checkbox" value="1" /> Education<br>
<input  id="00N300000036FHA" name="00N300000036FHA" type="checkbox" value="1" /> Social Security Number search<br>
<input  id="00N300000036FHF" name="00N300000036FHF" type="checkbox" value="1" /> Drug screening<br>
<input  id="00N300000036FHB" name="00N300000036FHB" type="checkbox" value="1" /> Motor vehicle history<br>
<input  id="00N300000036FHP" name="00N300000036FHP" type="checkbox" value="1" /> Credit history<br>
<input  id="00N300000036FHC" name="00N300000036FHC" type="checkbox" value="1" /> Personal references<br>
<input  id="00N300000036FZJ" name="00N300000036FZJ" type="checkbox" value="1" /> License verfication<br>
<input  id="00N300000036FdY" name="00N300000036FdY" type="checkbox" value="1" /> Sex offender<br>
<input  id="00N300000036FdW" name="00N300000036FdW" type="checkbox" value="1" /> Worker&#39;s compensation<br>
<input  id="00N300000036Fdb" name="00N300000036Fdb" type="checkbox" value="1" /> Other/additional<br>
</TD>
</TR>
<TR>
<TD COLSPAN=2><BR>What is the best time to contact you? <input  id="00N300000036Fe5" maxlength="255" name="00N300000036Fe5" size="20" type="text" /></TD>
</TR>
<TR>
<TD VALIGN=TOP COLSPAN=2><BR>Any additional comments or questions?<BR><textarea  id="00N300000036FdX" name="00N300000036FdX" cols="40" rows="3" type="text" wrap="soft"></textarea><BR><BR></TD>
</TR>
<tr>
<td>
<tr>
<td>
 
 
<script type="text/javascript"
       src="http://www.google.com/recaptcha/api/challenge?k=6Lfxf94SAAAAAHmtIqAaBJGKt5KuXNPHZ0qLGBlQ">
    </script>
    <noscript>
       <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lfxf94SAAAAAHmtIqAaBJGKt5KuXNPHZ0qLGBlQ"
           height="300" width="500" frameborder="0"></iframe><br>
       <textarea name="recaptcha_challenge_field" rows="3" cols="40">
       </textarea>
       <input type="hidden" name="recaptcha_response_field"
           value="manual_challenge">
    </noscript>
 
 
  </td>
  </tr>
 

</td>
</tr>

</TABLE>
<P>
<CENTER><INPUT TYPE="submit" VALUE="    SUBMIT    "></CENTER>
<P>
</FORM>

</DIV>
</TD>
<!--content column-->
<!--gutter--><TD WIDTH=30><IMG SRC="../images/spacer.gif" HEIGHT=1 WIDTH=30></TD><!--gutter-->
<!--grey line--><TD WIDTH=1 BACKGROUND="../images/dottedline.gif"><IMG SRC="../images/spacer.gif" HEIGHT=1 WIDTH=1></TD><!--grey line-->
<!--right column-->
<TD WIDTH=175 VALIGN=TOP>
<IMG SRC="../images/photo-runners.jpg">
<P>
<!--put side nav here-->
<BR><BR><BR><BR>
</TD>
<!--right column-->
</TR>
</TABLE>
<P>
<!--#include virtual="/includes/footer.htm"-->
</body>
</html>
 
 
 

Brett Gaborit

unread,
Mar 25, 2013, 10:50:23 AM3/25/13
to reca...@googlegroups.com
Hi Mark, I'm getting the same thing with my classic asp page. Have you done a Response.Write to print the value of Request("recaptcha_challenge_field") and Request("recaptcha_response_field") after postback?

I write an alert and they are being set prior to pastback (the javascript alert displays the correct values) but after postback the Request items have no value, hence not validating the recaptcha as a result of this statement:-

 if (recaptcha_challenge_field <> "" or recaptcha_response_field <> "") then 

You can test duplicating my problem here

Although I'm sorry I can't help you fix your issue, it's interesting that we are both experiencing the same issue. It's seems crazy that the fields are losing their value.

Regards, Brett.

Brett Gaborit

unread,
Mar 25, 2013, 11:15:06 AM3/25/13
to reca...@googlegroups.com
Hi Mark,

No unfortunately has helped so far.

I can't see the recaptcha on the page you sent the link for.

Brett

Brett Gaborit

unread,
Mar 27, 2013, 10:37:24 AM3/27/13
to reca...@googlegroups.com
Hi Mike,

I finally solved the problem....Make sure your <form> tags are outside the <table> tags. Weird, but it caused the problem.

Brett.

Brett Gaborit

unread,
Mar 27, 2013, 10:37:51 AM3/27/13
to reca...@googlegroups.com
Hi Mark,

I finally solved the problem....Make sure your <form> tags are outside the <table> tags. Weird, but it caused the problem.

Brett.

On Monday, March 25, 2013 11:41:50 PM UTC+10:30, Mark Windsor wrote:
Reply all
Reply to author
Forward
0 new messages