testing changes to contact form

This commit is contained in:
Gary 2025-06-17 11:50:25 +01:00
parent 1de4969e82
commit da306f598b

View File

@ -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']
];
}
?>