Monday, April 20, 2009

How to add captcha to your form

  1. Download the recaptcha library here
  2. Sign up for a captcha key here
  3. Copy recaptchalib.php from your unzipped library to the directory your form will be in
  4. Put this into your form :
    $publickey = "..."; // you got this from the signup page
    echo recaptcha_get_html($publickey);
  5. Put this into your processing page:
    $privatekey = "...";
    $resp = recaptcha_check_answer ($privatekey,

    if (!$resp->is_valid) {
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
    "(reCAPTCHA said: " . $resp->error . ")");

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Web Design & Marketing - Click and get an instant quote on your project