diff --git a/contact.php b/contact.php index 46fbd90..6e0597a 100644 --- a/contact.php +++ b/contact.php @@ -10,27 +10,37 @@ 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'] - ]; +// Function to generate a new CAPTCHA +function generateCaptcha() +{ + $num1 = rand(1, 10); + $num2 = rand(1, 10); + $answer = $num1 + $num2; + return ['num1' => $num1, 'num2' => $num2, 'answer' => $answer]; } +// Initialize CAPTCHA for the first load +$captcha = generateCaptcha(); +$captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?"; +$captcha_correct_answer = $captcha['answer']; + if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = trim($_POST['name']); $email = trim($_POST['email']); $phone = trim($_POST['phone']); $subject = trim($_POST['subject']); $message = trim($_POST['message']); - $captcha_input = isset($_POST['captcha']) ? (int)$_POST['captcha'] : 0; + $captcha_input = isset($_POST['captcha_user_input']) ? (int)$_POST['captcha_user_input'] : 0; + $captcha_expected_answer = isset($_POST['captcha_hidden_answer']) ? (int)$_POST['captcha_hidden_answer'] : 0; - if ($captcha_input !== $_SESSION['captcha']['answer']) { + if ($captcha_input !== $captcha_expected_answer) { echo "
Incorrect CAPTCHA answer. Please try again.
"; + // Re-generate CAPTCHA for a new attempt + $captcha = generateCaptcha(); + $captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?"; + $captcha_correct_answer = $captcha['answer']; } else { - $to = "info@warmseal-roofing.co.uk"; + $to = "enquiries@warmseal-roofing.co.uk"; $website_name = "Warmseal Roofing contact"; $from_email = "noreply@" . $_SERVER['HTTP_HOST']; $headers = "From: " . $website_name . " <" . $from_email . ">" . "\r\n" . @@ -47,19 +57,19 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { if (mail($to, 'New Message from ' . $website_name, $body, $headers)) { echo "
Thank you for contacting us. We will get back to you shortly.
"; + // Re-generate CAPTCHA after successful submission + $captcha = generateCaptcha(); + $captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?"; + $captcha_correct_answer = $captcha['answer']; } else { echo "
There was an error sending your message. Please try again.
"; + // Re-generate CAPTCHA for a new attempt if email sending fails + $captcha = generateCaptcha(); + $captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?"; + $captcha_correct_answer = $captcha['answer']; } } - - // 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'] - ]; } - ?>
diff --git a/includes/header.php b/includes/header.php index 9834929..ba047c4 100644 --- a/includes/header.php +++ b/includes/header.php @@ -36,6 +36,7 @@

+

diff --git a/index.php b/index.php index 5f232ad..fc08d61 100644 --- a/index.php +++ b/index.php @@ -12,6 +12,24 @@ include_once $URLcorrection . "includes/nav.php"; include_once $URLcorrection . "sections/about-us.php"; include_once $URLcorrection . "sections/counter.php"; include_once $URLcorrection . "sections/services-3.php"; +?> + +
+
+
+
+ + +

Call Us Now: 01254492373

+
+

Don't compromise on the most vital part of your home. Contact Warmseal today for a free, no-obligation survey and quotation for your roofing project. Let us provide a durable, beautiful roof that protects your investment for decades to come.

+

Request a Quote

+
+
+
+
+ +
-

Expert roof repairs with long-lasting results.

+

Expert roof repairs with long-lasting results.

@@ -36,7 +36,7 @@ include_once $URlcorrection . "includes/nav.php";
-

New roof installation with premium materials.

+

New roof installation with premium materials.

@@ -48,7 +48,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Emergency roofing services

+

Emergency roofing services

@@ -60,7 +60,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Full roof replacements with workmanship guarantee.

+

Full roof replacements with workmanship guarantee.

@@ -73,7 +73,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Tiled roof repairs and replacements done right

+

Tiled roof repairs and replacements done right

@@ -85,7 +85,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Slating and tiling specialists since 2003.

+

Slating and tiling specialists since 2003.

@@ -97,7 +97,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Weatherproofing your home with care.

+

Weatherproofing your home with care.

@@ -109,7 +109,7 @@ include_once $URlcorrection . "includes/nav.php";
-

No job too big or small – we handle it all

+

No job too big or small – we handle it all

@@ -122,7 +122,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Quality fascia and soffit installations.

+

Quality fascia and soffit installations.

@@ -134,7 +134,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Free roofing inspections with no obligation.

+

Free roofing inspections with no obligation.

@@ -146,7 +146,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Trusted by homeowners across the UK

+

Trusted by homeowners across the UK

@@ -158,7 +158,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Keeping your roof strong through every season

+

Keeping your roof strong through every season

@@ -170,7 +170,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Eco-friendly roofing options available.

+

Eco-friendly roofing options available.

@@ -182,7 +182,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Insured, certified, and experienced roofing professionals.

+

Insured, certified, and experienced roofing professionals.

@@ -194,7 +194,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Storm damage? We’ll fix it fast.

+

Storm damage? We’ll fix it fast.

@@ -206,7 +206,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Leadwork services done with precision

+

Leadwork services done with precision

@@ -218,7 +218,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Storm damage? We’ll fix it fast.

+

Storm damage? We’ll fix it fast.

@@ -230,7 +230,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Protect your investment with our roof care.

+

Protect your investment with our roof care.

@@ -242,7 +242,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Honest advice, no hidden costs

+

Honest advice, no hidden costs

@@ -254,7 +254,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Restoring roofs to their former glory

+

Restoring roofs to their former glory

@@ -266,7 +266,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Your local roofing experts, always nearby

+

Your local roofing experts, always nearby

@@ -278,7 +278,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Pitched roofing that stands the test of time

+

Pitched roofing that stands the test of time

@@ -290,7 +290,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Fixing leaks fast with expert solutions

+

Fixing leaks fast with expert solutions

@@ -302,7 +302,7 @@ include_once $URlcorrection . "includes/nav.php";
-

All work backed by full warranties

+

All work backed by full warranties

@@ -314,7 +314,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Custom roofing tailored to your property

+

Custom roofing tailored to your property

@@ -326,7 +326,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Safe, efficient scaffolding for every project

+

Safe, efficient scaffolding for every project

@@ -338,7 +338,7 @@ include_once $URlcorrection . "includes/nav.php";
-

We use only trusted, high-quality materials

+

We use only trusted, high-quality materials

@@ -350,7 +350,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Heritage roofing with traditional craftsmanship

+

Heritage roofing with traditional craftsmanship

@@ -362,7 +362,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Detailed quotes with clear timelines

+

Detailed quotes with clear timelines

@@ -374,7 +374,7 @@ include_once $URlcorrection . "includes/nav.php";
-

A roof you can count on, year after year

+

A roof you can count on, year after year

@@ -386,7 +386,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Customer satisfaction is our top priorit

+

Customer satisfaction is our top priority

@@ -398,7 +398,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Roofing excellence from start to finish

+

Roofing excellence from start to finish

@@ -410,7 +410,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Craftsmanship you can see in every detail

+

Craftsmanship you can see in every detail

@@ -422,7 +422,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Your peace of mind starts at the top

+

Your peace of mind starts at the top

@@ -434,7 +434,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Proudly raising the standards in roofing

+

Proudly raising the standards in roofing

@@ -446,7 +446,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Dependable service from a name you can trust

+

Dependable service from a name you can trust

@@ -458,7 +458,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Built on integrity, delivered with care

+

Built on integrity, delivered with care

@@ -470,7 +470,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Every job finished to the highest standard

+

Every job finished to the highest standard

@@ -482,7 +482,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Attention to detail from start to finish

+

Attention to detail from start to finish

@@ -494,7 +494,7 @@ include_once $URlcorrection . "includes/nav.php";
-

Where quality meets reliability

+

Where quality meets reliability

diff --git a/sections/projects.php b/sections/projects.php index 66b5caf..78d87e1 100644 --- a/sections/projects.php +++ b/sections/projects.php @@ -1,5 +1,5 @@
-
+
Our