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