From 175022f5192eeaf40834361c1ae4ab8da4b94c47 Mon Sep 17 00:00:00 2001 From: discomrade Date: Mon, 31 Jan 2022 00:52:02 -0100 Subject: [PATCH] Move PHP session into captcha code to prevent unnecessary cookies. --- post.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/post.php b/post.php index 7ede04ad..ef3bfa34 100644 --- a/post.php +++ b/post.php @@ -169,9 +169,12 @@ elseif (isset($_GET['Newsgroups'])) { error("NNTPChan: NNTPChan support is disabled"); } -session_start(); -if (!isset($_POST['captcha_cookie']) && isset($_SESSION['captcha_cookie'])) { - $_POST['captcha_cookie'] = $_SESSION['captcha_cookie']; +// Create session cookie if not already done and captchas are enabled +if ($config['captcha']['enabled'] || $config['report_captcha']) { + session_start(); + if (!isset($_POST['captcha_cookie']) && isset($_SESSION['captcha_cookie'])) { + $_POST['captcha_cookie'] = $_SESSION['captcha_cookie']; + } } if (isset($_POST['delete'])) { @@ -338,7 +341,7 @@ if (isset($_POST['delete'])) { $resp = curl_exec($ch); if ($resp !== '1') { - error($config['error']['captcha']); + error($config['error']['captcha']); } } } @@ -454,7 +457,7 @@ if (isset($_POST['delete'])) { $resp = curl_exec($ch); if ($resp !== '1') { - error($config['error']['captcha'] . + error($config['error']['captcha'] . ''); } }