Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/includes/class.recaptcha.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/class.recaptcha.php')
-rw-r--r--includes/class.recaptcha.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/includes/class.recaptcha.php b/includes/class.recaptcha.php
new file mode 100644
index 0000000..d998d43
--- /dev/null
+++ b/includes/class.recaptcha.php
@@ -0,0 +1,33 @@
+<?php
+/* quick solution
+* https://developers.google.com/recaptcha/docs/verify
+*/
+class recaptcha
+{
+
+ function verify(){
+ global $fs;
+
+ $url = 'https://www.google.com/recaptcha/api/siteverify';
+ $data = array(
+ 'secret' => $fs->prefs['captcha_recaptcha_secret'],
+ 'response' => $_POST['g-recaptcha-response']
+ );
+
+ $options = array(
+ 'http' => array (
+ 'method' => 'POST',
+ /* for php5.3, default enctype for http_build_query() was added with php5.4, http://php.net/manual/en/function.http-build-query.php */
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
+ 'content' => http_build_query($data, '', '&')
+ )
+ );
+
+ $context = stream_context_create($options);
+ $verify = file_get_contents($url, false, $context);
+ $captcha_success=json_decode($verify);
+
+ return $captcha_success->success;
+ }
+
+} # end class