summaryrefslogtreecommitdiff
path: root/public/captcha.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-05-03 01:39:13 +0500
committerilotterytea <iltsu@alright.party>2025-05-03 01:39:13 +0500
commit64f0533dc1779e7cca5f2678f7ae560df8d922bb (patch)
treebe319637f1a6ae6839b3685d6348a528025a7248 /public/captcha.php
parent0c25e3dd54225b126ad8e48e10f4fbde8ce26ec5 (diff)
feat: config sample and more config options
Diffstat (limited to 'public/captcha.php')
-rw-r--r--public/captcha.php11
1 files changed, 6 insertions, 5 deletions
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"]))
<html>
<head>
- <title>Resolving a hCaptcha for alright.party</title>
+ <title>Resolving a hCaptcha - <?php echo INSTANCE_NAME ?></title>
<link rel="stylesheet" href="/static/style.css">
<script src='https://www.hCaptcha.com/1/api.js' async defer></script>
</head>