File "contact.php"

Full path: /home/zvmcccat/public_html/adn/contact.php
File size: 4.62 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

<?php
require_once __DIR__ . '/includes/config.php';

session_start();
if (empty($_SESSION['csrf_token'])) {
    $_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
// Timestamp used by contact-handler.php as a simple anti-bot check —
// scripted submissions tend to arrive implausibly fast after the page loads.
$_SESSION['contact_form_rendered_at'] = time();

$meta_title = 'Contact';
$meta_description = 'Contact Alpha Design & Networking — head office, branch, phone, email, and a direct quote-request form.';
$current_page = 'contact';
require __DIR__ . '/includes/header.php';

$page_h1 = 'Contact Us';
$page_lede = 'Consultancy, turnkey delivery, system integration or a product quote — reach our team directly.';
require __DIR__ . '/includes/partials/page-hero.php';

$products = alpha_load_data('products.php');
$categories = array_values(array_unique(array_column($products, 'category')));
$interestOptions = array_merge(
    ['General Inquiry', 'Turnkey Project / Contracting', 'Facility Management / Maintenance'],
    $categories
);
$selectedInterest = $_GET['interest'] ?? '';

$status = $_GET['status'] ?? '';
?>

<section class="pad">
    <div class="contact-layout">
        <div class="contact-info-card">
            <h3>Head Office</h3>
            <div class="office">
                <p><?= ADDRESS_HQ ?></p>
            </div>
            <div class="office">
                <h4>Branch Office</h4>
                <p><?= ADDRESS_BRANCH ?></p>
            </div>
            <div class="office">
                <h4>Phone</h4>
                <p><a href="tel:<?= CONTACT_PHONE_LANDLINE_TEL ?>"><?= CONTACT_PHONE_LANDLINE_DISPLAY ?></a><br>
                <a href="tel:<?= CONTACT_PHONE_MOBILE_TEL ?>"><?= CONTACT_PHONE_MOBILE_DISPLAY ?></a></p>
            </div>
            <div class="office">
                <h4>Email</h4>
                <p><a href="mailto:<?= CONTACT_EMAIL_INFO ?>"><?= CONTACT_EMAIL_INFO ?></a><br>
                <a href="mailto:<?= CONTACT_EMAIL_SALES ?>"><?= CONTACT_EMAIL_SALES ?></a></p>
            </div>
        </div>

        <form class="contact-form" action="contact-handler.php" method="post" novalidate>
            <?php if ($status === 'sent'): ?>
                <div class="form-alert success">Thanks — your message has been sent. We'll be in touch shortly.</div>
            <?php elseif ($status === 'error'): ?>
                <div class="form-alert error">Something wasn't right — please check the required fields and try again.</div>
            <?php endif; ?>

            <input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token'], ENT_QUOTES) ?>">

            <div class="honeypot-field" aria-hidden="true">
                <label for="website">Leave this field blank</label>
                <input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
            </div>

            <div class="form-row-grid">
                <div class="form-row">
                    <label for="name">Name *</label>
                    <input type="text" id="name" name="name" required>
                </div>
                <div class="form-row">
                    <label for="company">Company</label>
                    <input type="text" id="company" name="company">
                </div>
            </div>

            <div class="form-row-grid">
                <div class="form-row">
                    <label for="email">Email *</label>
                    <input type="email" id="email" name="email" required>
                </div>
                <div class="form-row">
                    <label for="phone">Phone</label>
                    <input type="tel" id="phone" name="phone">
                </div>
            </div>

            <div class="form-row">
                <label for="interest">I'm interested in</label>
                <select id="interest" name="interest">
                    <?php foreach ($interestOptions as $option): ?>
                        <option value="<?= htmlspecialchars($option, ENT_QUOTES) ?>"<?= $selectedInterest === $option ? ' selected' : '' ?>><?= htmlspecialchars($option, ENT_QUOTES) ?></option>
                    <?php endforeach; ?>
                </select>
            </div>

            <div class="form-row">
                <label for="message">Message *</label>
                <textarea id="message" name="message" required></textarea>
            </div>

            <button type="submit" class="btn btn-accent">Send Message</button>
            <p class="form-note">We'll only use these details to respond to your enquiry.</p>
        </form>
    </div>
</section>

<?php require __DIR__ . '/includes/footer.php'; ?>