1) Скачать библиотеку ReCaptcha здесь https://code.google.com/p/recaptcha/downloads/detail?name=recaptcha-php-1.11.zip&can=2&q=label%3Aphplib-Latest
2) Распакуйте его и скопируйте файл recaptchalib.php
в каталог, где находится ваш файл формы.
3) Регистрация для рекапчи здесь http://www.google.com/recaptcha/whyrecaptcha
4) копия открытого ключа и вставить его в нужное место в вашем виде файла, который должен выглядеть примерно так:
<html>
<body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
<!-- your HTML content -->
<form method="post" action="verify.php">
Name:<input type="text" name="name"> <br>
Email: <input type="email" name="email">
<?php
require_once('recaptchalib.php');
$publickey = "your public key here"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<input type="submit" />
</form>
<!-- more of your HTML content -->
</body>
</html>
5) Затем создать другой файл, verify.php, который также должен находиться в вашей форме и файлах recaptchalib.php.
<?php
require_once('recaptchalib.php');
$privatekey = "your private key here";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
echo "Success!";
}
?>
6) На странице, где вы получили открытый ключ, теперь скопировать закрытый ключ и вставить его в нужном месте в файле verify.php
.
http://www.google.com/recaptcha/whyrecaptcha – hex4
да документация недостаточно, пожалуйста, помогите, я попробую – user2715353