471,874 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,874 software developers and data experts.

reCAPTCHA PHP to stop spam

69
Hi,

Has anyone used this successfully in PHP to prevent spam mails sent from HTML forms? I've added it to a form of mine and it seems a bit hit and miss. I incorrectly enter the captcha and it correctly says its incorrect. I try again with another incorrect response and it accepts it?

Am I doing something wrong or is there a problem with reCAPTCHA?

Thanks,

Sean
Nov 12 '07 #1
2 1846
Atli
5,058 Expert 4TB
Hi Sean.

There must something be a little of for it to act like that. It could simply be that you overlooked some minor detail when you wrote your code.

Did you write the code from scratch or are you using something you got from somewhere else?
Could you show us the code that is likely to be causing this behavior?
Nov 12 '07 #2
Sebarry
69
Hi Thanks, yes my code is as follows. I'm using Smarty with PHP.

At the top of the PHP file:

Expand|Select|Wrap|Line Numbers
  1. require_once('includes/recaptcha-php-1.9/recaptchalib.php');
  2.  
  3. $privatekey = "6LeYowAAAAAAAMiylx8fE5Hs85ZfX7KraUler1gi";
  4. $publickey = "6LeYowAAAAAAAFLqbuAe3Byvu98D0EQAZuyvSVH2"; // you got this from the signup page
  5. $smarty->assign( 'recaptcha', recaptcha_get_html( $publickey ) );
  6.  
To process the form:

Expand|Select|Wrap|Line Numbers
  1. $resp = recaptcha_check_answer ($privatekey,
  2.     $_SERVER["REMOTE_ADDR"],
  3.     $_POST["recaptcha_challenge_field"],
  4.     $_POST["recaptcha_response_field"]);
  5.  
Sean

Hi Sean.

There must something be a little of for it to act like that. It could simply be that you overlooked some minor detail when you wrote your code.

Did you write the code from scratch or are you using something you got from somewhere else?
Could you show us the code that is likely to be causing this behavior?
Nov 12 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

26 posts views Thread by Ricardo | last post: by
7 posts views Thread by dotnetprogrammer via DotNetMonster.com | last post: by
1 post views Thread by dineshkaku | last post: by
1 post views Thread by Subcomandante | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.