Created
December 28, 2013 09:48
-
-
Save amite/8157833 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once('recaptchalib.php'); | |
| // Get a key from https://www.google.com/recaptcha/admin/create | |
| $publickey = ""; | |
| $privatekey = ""; | |
| # the response from reCAPTCHA | |
| $resp = null; | |
| # the error code from reCAPTCHA, if any | |
| $error = null; | |
| # was there a reCAPTCHA response? | |
| if ($_POST["recaptcha_response_field"]) { | |
| $resp = recaptcha_check_answer ($privatekey, | |
| $_SERVER["REMOTE_ADDR"], | |
| $_POST["recaptcha_challenge_field"], | |
| $_POST["recaptcha_response_field"]); | |
| if ($resp->is_valid) { | |
| echo "You got it!"; | |
| } else { | |
| # set the error code so that we can display it | |
| $error = $resp->error; | |
| } | |
| } | |
| echo recaptcha_get_html($publickey, $error); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment