summaryrefslogtreecommitdiff
path: root/recaptcha-php/example-captcha.php
diff options
context:
space:
mode:
authorAndreas Habel <mail@exceptionfault.de>2009-10-18 16:10:27 +0200
committerAndreas Habel <mail@exceptionfault.de>2009-10-18 16:10:27 +0200
commit935897a79a6014bc0c34285e3a58e872864de1e4 (patch)
tree7db123ae687087b45588b825a9cbfce854f659d9 /recaptcha-php/example-captcha.php
parentb6a41f518c6072fa0e9689f2df547b495e62e401 (diff)
downloadwebsite-935897a79a6014bc0c34285e3a58e872864de1e4.tar.gz
website-935897a79a6014bc0c34285e3a58e872864de1e4.tar.bz2
website-935897a79a6014bc0c34285e3a58e872864de1e4.tar.xz
website-935897a79a6014bc0c34285e3a58e872864de1e4.zip
Added new page for online account registration.
Needs call to ladmin to really create an account.
Diffstat (limited to 'recaptcha-php/example-captcha.php')
-rw-r--r--recaptcha-php/example-captcha.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/recaptcha-php/example-captcha.php b/recaptcha-php/example-captcha.php
new file mode 100644
index 0000000..1c4ca5f
--- /dev/null
+++ b/recaptcha-php/example-captcha.php
@@ -0,0 +1,37 @@
+<html>
+ <body>
+ <form action="" method="post">
+<?php
+
+require_once('recaptchalib.php');
+
+// Get a key from http://recaptcha.net/api/getkey
+$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);
+?>
+ <br/>
+ <input type="submit" value="submit" />
+ </form>
+ </body>
+</html>