Avatar of nsitedesigns
nsitedesignsFlag for United States of America asked on

reCaptcha Form sending out regardless

I added recatpcha to this beta website. Tested it and all appeared to go good until I realized that you can type in anything in the recaptcha field and the form will submit.  Does anyone know how to fix that.  This is my first official do-hicky like this and I don't know why it doesn't work.

p.s.  Yes, I realize that when we go live, I will have to do it all over again.
Web DevelopmentHTMLScripting Languages

Avatar of undefined
Last Comment
nsitedesigns

8/22/2022 - Mon
COBOLdinosaur

The most likely cause is a failure in validation on the server side.  However without any code to look at, all we can do is speculate.


Cd&
ASKER
nsitedesigns

sorry, forgot to include url

http://kleiberconstruction2.info/contact.html
COBOLdinosaur

The way I read it, the form gets submitted if the the submit button is clicked, I don't see anything that prevent it, or validates the captcha before submission.

IMO this is not a good way to do captcha, everything should be in the form handler on the server side.

Cd&
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
nsitedesigns

these directions were from the recapta site.  Can you please provide me with a site that shows how you would recommend it be added to a website.
COBOLdinosaur

I question the need for recaptcha, unless your site is being overrun with robots, a very simple implementation is all that's needed; and would be more user friendly.  Making the image unreadable does not make it much more effective against robots and does make thing more difficult for users.

Try a simple all server side implementation Like this


Cd&
ASKER
nsitedesigns

I do not understand this portion of your white-hat sample code.  What does it mean, place it where the form is submitted to?

Place the following in the code where the form is submitted to. This code
will check what the user has typed matches the code in the image.
session_start();
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
      unset($_SESSION['security_code']);
} else {
      // Insert your code for showing an error message here
}
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
nsitedesigns

Also,  I put the code into a row immediately above the submit button, yet it appears above the form.  How do I move it down?
<form action="/gdform.php" method="post"> 
      
      <input type="hidden" name="subject" value="Form Submission" /> 
      <input type="hidden" name="redirect" value="thankyou.html" />
   
  <table width="93%" border="1" cellpadding="14" cellspacing="1">
    <tr>
      <td valign="top">Full Name</td>
      <td valign="top" bgcolor="#f9e5c2"><input name="1_Name" type="text" id="1_Name" size="60" /></td>
      </tr>
    <tr>
      <td valign="top">Address 1 </td>
      <td valign="top"><input name="5_Address1" type="text" id="Address1" size="60" /></td>
      </tr>
    <tr>
      <td valign="top">Address 2</td>
      <td valign="top" bgcolor="#f9e5c2"><input name="6_Address2" type="text" id="Address2" size="60" /></td>
      </tr>
    <tr>
      <td valign="top">City </td>
      <td valign="top"><input name="7_City" type="text" id="City" size="33" /></td>
      </tr>
    <tr>
      <td valign="top">State</td>
      <td valign="top" bgcolor="#f9e5c2"><input name="8_State" type="text" id="8_State" size="4" /></td>
      </tr>
    <tr>
      <td valign="top">Zip Code</td>
      <td valign="top"><input name="9_Zip" type="text" id="9_Zip" size="10" /></td>
      </tr>
    <tr>
      <td valign="top">Phone
        (Night)</td>
      <td valign="top" bgcolor="#f9e5c2"><input name="4_Phone_Night" type="text" id="4_Phone_Night" size="15" /></td>
      </tr>
    <tr>
      <td valign="top">Phone (Day)</td>
      <td valign="top"><input name="3_Phone_Day" type="text" id="3_Phone_Day" size="15" /></td>
      </tr>
    <tr>
      <td valign="top">Email</td>
      <td valign="top" bgcolor="#f9e5c2"><input name="2_Email" type="text" size="60" id="2_Email" /></td>
      </tr>
    <tr>
      <td valign="top">Comments</td>
      <td valign="top"><textarea name="Comments" cols="50" rows="10" id="Comments"></textarea></td>
      </tr>
    <tr>
      <img src="CaptchaSecurityImages.php" alt="" />
Security Code:
<input id="security_code" name="security_code" type="text" />
    </tr>
    
  </table>
<p>
<input type="Submit" name="Submit" value="Submit" id="Submit"/>
                &nbsp;&nbsp;&nbsp;<input type="reset" name="Reset" value="Reset" id="Reset" />
      </p>
  </form>

Open in new window

ASKER CERTIFIED SOLUTION
COBOLdinosaur

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
nsitedesigns

Pardon me for saying this but, I guess telling me my html is poorly written isn't really giving me direction as to how to reposition this code so it is in the right spot. The previous captcha code I tried to implement was placed in a table row and it sat exactly where I wanted it to be.
ASKER
nsitedesigns

So, I place the code below on the CaptchaSecurityImages.php page?  If so, where on this page do I put it.  Please advise.  I don't really know php.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
COBOLdinosaur

You have a row with no cells.  The browser is just trying to guess what the invalid code is supposed to do.

Generally when someone is implementing something like CAPTCHA they have a skill level that does not require a lot of basics.  If I assumed the wrong skill level I appologize.


Cd&
ASKER
nsitedesigns

I am pretty familiar with html and as i mentioned earlier, I do not know php.  I was lead to believe that adding a captcha code was going to be a walk in the park.  That hasn't been the case.  It's been hours that I have been trying to figure this out.  I am cutting bait and calling it a loss.
ASKER
nsitedesigns

I am giving you points because you attempted to help me but I was still unable to figure it out.  I guess as you mentioned, my skill levels are way below what is needed to do this very simple process.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.