comparison sites/all/modules/recaptcha/recaptcha-php-1.11/example-captcha.php @ 2:b74b41bb73f0

-- Google analytics module
author danieleb <danielebarchiesi@me.com>
date Thu, 22 Aug 2013 17:22:54 +0100
parents
children
comparison
equal deleted inserted replaced
1:67ce89da90df 2:b74b41bb73f0
1 <html>
2 <body>
3 <form action="" method="post">
4 <?php
5
6 require_once('recaptchalib.php');
7
8 // Get a key from https://www.google.com/recaptcha/admin/create
9 $publickey = "";
10 $privatekey = "";
11
12 # the response from reCAPTCHA
13 $resp = null;
14 # the error code from reCAPTCHA, if any
15 $error = null;
16
17 # was there a reCAPTCHA response?
18 if ($_POST["recaptcha_response_field"]) {
19 $resp = recaptcha_check_answer ($privatekey,
20 $_SERVER["REMOTE_ADDR"],
21 $_POST["recaptcha_challenge_field"],
22 $_POST["recaptcha_response_field"]);
23
24 if ($resp->is_valid) {
25 echo "You got it!";
26 } else {
27 # set the error code so that we can display it
28 $error = $resp->error;
29 }
30 }
31 echo recaptcha_get_html($publickey, $error);
32 ?>
33 <br/>
34 <input type="submit" value="submit" />
35 </form>
36 </body>
37 </html>