summaryrefslogtreecommitdiff
path: root/includes/class.recaptcha.php
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-11-17 20:45:02 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2019-11-17 20:45:02 +0100
commit8df3db566a3a937b45ebf11adb90d265e6f5e2d4 (patch)
tree4d541098d751d5a9acf8c12f6fb9f308ace066ac /includes/class.recaptcha.php
downloadflyspray-8df3db566a3a937b45ebf11adb90d265e6f5e2d4.tar.xz
initial checking of customized version 1.0rc9
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