summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2022-12-12 06:14:48 -0800
committerCarson Fleming <cflems@cflems.net>2022-12-12 06:14:48 -0800
commitd9c65d451785c7c8a5a652d2f23a3db2a97ad534 (patch)
tree3df6228591010f77c8df2d2ee8acd97183ae5285 /inc
parenta8445664e8453ac643f123b43823a6a9df83c421 (diff)
downloadbulletin-d9c65d451785c7c8a5a652d2f23a3db2a97ad534.tar.gz
Fix captcha verification
Diffstat (limited to 'inc')
-rw-r--r--inc/common.php2
-rw-r--r--inc/functions.php8
2 files changed, 5 insertions, 5 deletions
diff --git a/inc/common.php b/inc/common.php
index c921ae6..2b3966c 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1,6 +1,6 @@
<?php
define('INCLUDE_PATH', dirname(__FILE__).'/');
-
+error_reporting(E_ERROR | E_PARSE);
require(INCLUDE_PATH . 'config.php');
require(INCLUDE_PATH . 'functions.php');
//require(INCLUDE_PATH . 'mobile.php');
diff --git a/inc/functions.php b/inc/functions.php
index d3aa93e..dc67fab 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -109,14 +109,14 @@ function recaptcha_verify ($response) {
global $b_config;
$endpoint = 'https://google.com/recaptcha/api/siteverify';
- $data = json_encode(array(
+ $data = http_build_query(array(
'secret' => $b_config['recaptcha_api_secret'],
'response' => $response,
));
$ctx = stream_context_create(array(
'http' => array(
'method' => 'POST',
- 'header' => 'Content-Type: application/json' . "\r\n"
+ 'header' => 'Content-Type: application/x-www-form-urlencoded' . "\r\n"
. 'Content-Length: ' . strlen($data) . "\r\n",
'content' => $data
)
@@ -125,7 +125,7 @@ function recaptcha_verify ($response) {
if (!$result) return false;
$result = json_decode($result);
if (!$result) return false;
- return isset($result['success']) && isset($result['hostname']) &&
- $result['success'] && $result['hostname'] == $_SERVER['HTTP_HOST'];
+ return isset($result->success) && isset($result->hostname) &&
+ $result->success && $result->hostname == $_SERVER['HTTP_HOST'];
}
?>