From d9c65d451785c7c8a5a652d2f23a3db2a97ad534 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Mon, 12 Dec 2022 06:14:48 -0800 Subject: Fix captcha verification --- inc/common.php | 2 +- inc/functions.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'inc') 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 @@ $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']; } ?> -- cgit v1.2.3