From 64f0533dc1779e7cca5f2678f7ae560df8d922bb Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 3 May 2025 01:39:13 +0500 Subject: feat: config sample and more config options --- public/captcha.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'public/captcha.php') diff --git a/public/captcha.php b/public/captcha.php index d6e53e8..c872672 100644 --- a/public/captcha.php +++ b/public/captcha.php @@ -2,13 +2,14 @@ include_once "../src/config.php"; include_once "../src/alert.php"; +session_start(); + if (!HCAPTCHA_ENABLE) { - generate_alert("/404.php", "Captcha is not enabled on this instance", 404); + $_SESSION["captcha_solved"] = true; + header("Location: /"); exit; } -session_start(); - if (isset($_SESSION["captcha_solved"]) && $_SESSION["captcha_solved"]) { header("Location: /"); exit; @@ -18,7 +19,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["h-captcha-response"])) // sending a request to captcha api $request = curl_init("https://hcaptcha.com/siteverify"); curl_setopt($request, CURLOPT_POST, 1); - curl_setopt($request, CURLOPT_HTTPHEADER, ['User-Agent: alright.party/1.0']); + curl_setopt($request, CURLOPT_HTTPHEADER, [sprintf("User-Agent: %s/1.0", INSTANCE_NAME)]); curl_setopt( $request, CURLOPT_POSTFIELDS, @@ -42,7 +43,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["h-captcha-response"])) - Resolving a hCaptcha for alright.party + Resolving a hCaptcha - <?php echo INSTANCE_NAME ?> -- cgit v1.2.3