- Download the recaptcha library here
- Sign up for a captcha key here
- Copy recaptchalib.php from your unzipped library to the directory your form will be in
- Put this into your form :
require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey); - Put this into your processing page:
require_once('recaptchalib.php');
$privatekey = "...";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
Monday, April 20, 2009
How to add captcha to your form
Subscribe to:
Post Comments (Atom)
Web Design & Marketing - Click and get an instant quote on your project
No comments:
Post a Comment