From da306f598b987a2e4035a3ce4fb7f1e2f13388a3 Mon Sep 17 00:00:00 2001 From: Gary Date: Tue, 17 Jun 2025 11:50:25 +0100 Subject: [PATCH] testing changes to contact form --- contact.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/contact.php b/contact.php index e161b0e..fd934d6 100644 --- a/contact.php +++ b/contact.php @@ -10,14 +10,10 @@ include_once $URlcorrection . "includes/header.php"; include_once $URlcorrection . "includes/banner.php"; include_once $URlcorrection . "includes/nav.php"; -// Generate a new CAPTCHA question if not set -if (!isset($_SESSION['captcha'])) { - $_SESSION['captcha'] = [ - 'num1' => rand(1, 10), - 'num2' => rand(1, 10), - 'answer' => $_SESSION['captcha']['num1'] + $_SESSION['captcha']['num2'] - ]; -} +// Generate CAPTCHA numbers +$num1 = rand(1, 10); +$num2 = rand(1, 10); +$captchaAnswer = $num1 + $num2; if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = trim($_POST['name']); @@ -52,13 +48,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { } } - // Generate a new CAPTCHA for the next submission AFTER processing the form - $_SESSION['captcha'] = [ - 'num1' => rand(1, 10), - 'num2' => rand(1, 10), - 'answer' => $_SESSION['captcha']['num1'] + $_SESSION['captcha']['num2'] - ]; -} + ?>