webguync Posted January 14, 2011 Share Posted January 14, 2011 I have a form which is working, but the client wanted to add a recapatcha field so I am implementing that and placed the recaptcha code in the same directory as my form. The recaptcha displays, but you can enter in anything and the form still submits, so it's not doing any good! Not sure where the problem lies exactly, but was hoping for some help if someone has experienced anything similar. here is my code in the html <li> <pre> <script> var RecaptchaOptions = { theme : 'clean' }; </script> </pre> <?php require_once('../ContactUs/recaptchalib.php'); $publickey = "6LdZX8ASAAAAABUejj-bfZey47TTjN6X-EKfKBwy "; // you got this from the signup page echo recaptcha_get_html($publickey); ?> </li> the PHP to submit the Post data <?php if(!$_POST) exit; $email = $_POST['email']; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','phone','concerning','message','recaptcha_response_field'); $required = array('name','email','message','recaptcha_response_field'); $your_email = "[email protected]"; $email_subject = "New Message from our web site!"; $email_content = "new message:\n"; foreach($values as $value){ if(in_array($value,$required)){ if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(mail($your_email,$email_subject,$email_content)) { echo 'Your message has been successfully sent!'; } else { echo 'ERROR! please try again or use the email address listed above to contact Sandbox-Band'; } } ?> the recaptchalib.php file is exactly as I downloaded it from their site. Link to comment https://forums.phpfreaks.com/topic/224456-problems-with-recaptha-field-in-form/ Share on other sites More sharing options...
cmattoon Posted January 14, 2011 Share Posted January 14, 2011 ReCaptcha may be different than the Captcha script I've been using... but I dont see any code in your PHP script to check a value... it appears that you're only checking to see if they filled in a value. This may help: http://code.google.com/apis/recaptcha/docs/verify.html And This: http://code.google.com/apis/recaptcha/docs/php.html Link to comment https://forums.phpfreaks.com/topic/224456-problems-with-recaptha-field-in-form/#findComment-1159491 Share on other sites More sharing options...
webguync Posted January 14, 2011 Author Share Posted January 14, 2011 ok, it looks like I left out part of it thanks! Link to comment https://forums.phpfreaks.com/topic/224456-problems-with-recaptha-field-in-form/#findComment-1159513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.