171 lines
7.0 KiB
PHP
171 lines
7.0 KiB
PHP
<?php
|
|
|
|
$URlcorrection = "";
|
|
$PageTitle = "Contact Us | Get a Free Quote | Roofer in Accrington";
|
|
$Page = "contact";
|
|
$ometa['description'] = "Contact Warmseal Roofing for a free quote. Professional roofer in Accrington serving Lancashire. Call us for roof repairs, installations, and maintenance. Emergency callouts available.";
|
|
$ometa['keywords'] = "contact warmseal roofing, free roofing quote, roofer in accrington, roofing quote accrington, contact roofer, emergency roof repairs, accrington roofing services, get quote, roofing estimates, call roofer, roofing consultation, lancashire roofer contact";
|
|
include_once $URlcorrection . "includes/header.php";
|
|
|
|
include_once $URlcorrection . "includes/banner.php";
|
|
include_once $URlcorrection . "includes/nav.php";
|
|
|
|
// 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_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 !== $captcha_expected_answer) {
|
|
echo "<div class='alert alert-danger text-center'>Incorrect CAPTCHA answer. Please try again.</div>";
|
|
// Re-generate CAPTCHA for a new attempt
|
|
$captcha = generateCaptcha();
|
|
$captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?";
|
|
$captcha_correct_answer = $captcha['answer'];
|
|
} else {
|
|
$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" .
|
|
"Reply-To: " . $name . " <" . $email . ">" . "\r\n" .
|
|
"X-Mailer: PHP/" . phpversion();
|
|
$body = "You have received a new message from Warmseal Roofing Contact form:\n\n" .
|
|
"Name: " . $name . "\n" .
|
|
"Email: " . $email . "\n";
|
|
if (!empty($phone)) {
|
|
$body .= "Phone Number: " . $phone . "\n";
|
|
}
|
|
$body .= "Subject: " . $subject . "\n\n" .
|
|
"Message:\n" . $message;
|
|
|
|
if (mail($to, 'New Message from ' . $website_name, $body, $headers)) {
|
|
echo "<div class='alert alert-success text-center'>Thank you for contacting us. We will get back to you shortly.</div>";
|
|
// Re-generate CAPTCHA after successful submission
|
|
$captcha = generateCaptcha();
|
|
$captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?";
|
|
$captcha_correct_answer = $captcha['answer'];
|
|
} else {
|
|
echo "<div class='alert alert-danger text-center'>There was an error sending your message. Please try again.</div>";
|
|
// Re-generate CAPTCHA for a new attempt if email sending fails
|
|
$captcha = generateCaptcha();
|
|
$captcha_question = $captcha['num1'] . " + " . $captcha['num2'] . " = ?";
|
|
$captcha_correct_answer = $captcha['answer'];
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|
|
<section class="ftco-section bg-light padding-top-100 padding-bottom-100">
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-12">
|
|
<div class="wrapper">
|
|
<div class="row no-gutters">
|
|
<div class="col-md-7 d-flex">
|
|
<div class="contact-wrap w-100 p-md-5 p-4">
|
|
<h3 class="mb-4">Get in touch</h3>
|
|
<form method="POST" id="contactForm" class="contactForm">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="name" id="name" placeholder="Name" required>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<input type="email" class="form-control" name="email" id="email" placeholder="Email" required>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="phone" id="phone" placeholder="Phone Number" required>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" required>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<textarea name="message" class="form-control" id="message" cols="30" rows="7" placeholder="Message" required></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<label for="captcha">Security Check: What is <?php echo $_SESSION['captcha']['num1']; ?> + <?php echo $_SESSION['captcha']['num2']; ?>?</label>
|
|
<input type="number" id="captcha" name="captcha" class="form-control" required>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<input type="submit" value="Send Message" class="btn btn-primary">
|
|
<div class="submitting"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-5 d-flex align-items-stretch">
|
|
<div class="info-wrap bg-primary w-100 p-lg-5 p-4">
|
|
<h3 class="mb-4 mt-md-4">Contact us</h3>
|
|
<div class="dbox w-100 d-flex align-items-start">
|
|
|
|
</div>
|
|
<div class="dbox w-100 d-flex align-items-center">
|
|
<div class="icon d-flex align-items-center justify-content-center">
|
|
<span class="fa fa-phone"></span>
|
|
</div>
|
|
<div class="text pl-3">
|
|
<p><span>Mobile:</span> <a href="tel:07379893869">07379893869</a></p>
|
|
<p><span>Phone:</span> <a href="tel:01254492373">01254492373</a></p>
|
|
</div>
|
|
</div>
|
|
<div class="dbox w-100 d-flex align-items-center">
|
|
<div class="icon d-flex align-items-center justify-content-center">
|
|
<span class="fa fa-paper-plane"></span>
|
|
</div>
|
|
<div class="text pl-3">
|
|
<p><span>Email:</span> <a href="mailto:info@warmseal-roofing.co.uk">info@warmseal-roofing.co.uk</a></p>
|
|
</div>
|
|
</div>
|
|
<div class="dbox w-100 d-flex align-items-center">
|
|
<div class="icon d-flex align-items-center justify-content-center">
|
|
<span class="fa fa-globe"></span>
|
|
</div>
|
|
<div class="text pl-3">
|
|
<p><span>Address:</span>Unit 9, Pheonix Works, Willows Lane, Accrington, BB5 0RT</p>
|
|
<p>Covering a 50 mile radius of Accrington, including Blackburn, Burnley, Nelson, Colne, Clitheroe, and surrounding areas.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
<?php
|
|
include_once $URlcorrection . "includes/footer.php";
|
|
?>
|