<?php
// Contact form handler: change $to to the inbox that should receive messages.
$to = 'info@advanishly.com';
$status = '';
$errors = [];
$old = ['name' => '', 'email' => '', 'subject' => '', 'message' => ''];

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    foreach ($old as $k => $v) {
        $old[$k] = trim((string)($_POST[$k] ?? ''));
    }
    // Honeypot: real visitors never fill this hidden field.
    if (!empty($_POST['website'])) {
        $status = 'sent';
    } else {
        if ($old['name'] === '' || mb_strlen($old['name']) > 100) $errors['name'] = 'Please enter your name.';
        if (!filter_var($old['email'], FILTER_VALIDATE_EMAIL)) $errors['email'] = 'Please enter a valid email address.';
        if (mb_strlen($old['subject']) > 150) $errors['subject'] = 'Please keep the subject under 150 characters.';
        if (mb_strlen($old['message']) < 10) $errors['message'] = 'Please write a message of at least 10 characters.';
        if (empty($_POST['consent'])) $errors['consent'] = 'Please confirm you have read the Privacy Policy.';

        if (!$errors) {
            $clean = function ($s) { return str_replace(["\r", "\n"], ' ', $s); };
            $subject = 'AdVanishly contact: ' . ($old['subject'] !== '' ? $clean($old['subject']) : 'New message');
            $body = "Name: {$old['name']}\nEmail: {$old['email']}\nSubject: {$old['subject']}\n\n{$old['message']}\n";
            $headers = "From: AdVanishly <no-reply@advanishly.com>\r\nReply-To: " . $clean($old['email']) . "\r\nContent-Type: text/plain; charset=UTF-8";
            $status = @mail($to, $subject, $body, $headers) ? 'sent' : 'failed';
            if ($status === 'sent') $old = array_map(function () { return ''; }, $old);
        }
    }
}
function e($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us | AdVanishly</title>
<meta name="description" content="Contact AdVanishly, operated by Dynamic Graphics in Burleson, Texas.">
<link rel="canonical" href="https://advanishly.com/contact.html">
<link rel="icon" href="images/favicon.png" type="image/png">
<meta property="og:type" content="website">
<meta property="og:site_name" content="AdVanishly">
<meta property="og:title" content="Contact Us | AdVanishly">
<meta property="og:description" content="Contact AdVanishly, operated by Dynamic Graphics in Burleson, Texas.">
<meta property="og:url" content="https://advanishly.com/contact.html">
<meta property="og:image" content="https://advanishly.com/images/featured_image.webp">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700;12..96,800&family=Instrument+Serif:ital@0;1&family=Manrope:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/style.css">
</head>
<body>

<div class="topbar">Advertorial · Paid promotion</div>

<header class="site-header">
  <div class="wrap header-row">
    <a class="brand" href="/index.html"><img src="images/logo.png" alt="AdVanishly" width="186" height="52"></a>
    <a href="/index.html" class="btn btn-line btn-sm">Back to Home</a>
  </div>
</header>

<main>
  <section class="doc-hero">
    <div class="wrap">
      <h1>Contact Us</h1>
      <p>Have a question about a page, a correction to suggest or a general inquiry? We would be glad to hear from you.</p>
    </div>
  </section>

  <section class="doc-band">
    <div class="wrap">
      <article class="doc">
        <h2>Ways to Reach Us</h2>
        <div class="contact-cards">
          <div class="contact-card"><h3>Phone</h3><p><a href="tel:+18174548488">+1 817 454 8488</a></p></div>
          <div class="contact-card"><h3>Postal Address</h3><p>300 Boone Rd Ste A9, Burleson, TX 76028, United States</p></div>
          <div class="contact-card"><h3>Operated By</h3><p>Dynamic Graphics</p></div>
          <div class="contact-card"><h3>Website</h3><p><a href="/index.html">advanishly.com</a></p></div>
        </div>
        <h2 id="form">Send Us a Message</h2>
        <?php if ($status === 'sent'): ?>
        <div class="form-alert ok" role="status">Thank you. Your message has been sent and we will get back to you within a few business days.</div>
        <?php elseif ($status === 'failed'): ?>
        <div class="form-alert err" role="alert">Sorry, your message could not be sent right now. Please try again later or call us at +1 817 454 8488.</div>
        <?php elseif ($errors): ?>
        <div class="form-alert err" role="alert">Please check the highlighted fields and try again.</div>
        <?php endif; ?>
        <form class="contact-form" method="post" action="#form" novalidate>
          <div class="field">
            <label for="cf-name">Name</label>
            <input id="cf-name" name="name" type="text" autocomplete="name" maxlength="100" required value="<?= e($old['name']); ?>"<?= isset($errors['name']) ? ' aria-invalid="true"' : ''; ?>>
            <?php if (isset($errors['name'])): ?><small class="field-err"><?= e($errors['name']); ?></small><?php endif; ?>
          </div>
          <div class="field">
            <label for="cf-email">Email</label>
            <input id="cf-email" name="email" type="email" autocomplete="email" maxlength="150" required value="<?= e($old['email']); ?>"<?= isset($errors['email']) ? ' aria-invalid="true"' : ''; ?>>
            <?php if (isset($errors['email'])): ?><small class="field-err"><?= e($errors['email']); ?></small><?php endif; ?>
          </div>
          <div class="field full">
            <label for="cf-subject">Subject <span class="opt">(optional)</span></label>
            <input id="cf-subject" name="subject" type="text" maxlength="150" value="<?= e($old['subject']); ?>"<?= isset($errors['subject']) ? ' aria-invalid="true"' : ''; ?>>
            <?php if (isset($errors['subject'])): ?><small class="field-err"><?= e($errors['subject']); ?></small><?php endif; ?>
          </div>
          <div class="field full">
            <label for="cf-message">Message</label>
            <textarea id="cf-message" name="message" rows="6" maxlength="5000" required<?= isset($errors['message']) ? ' aria-invalid="true"' : ''; ?>><?= e($old['message']); ?></textarea>
            <?php if (isset($errors['message'])): ?><small class="field-err"><?= e($errors['message']); ?></small><?php endif; ?>
          </div>
          <div class="hp" aria-hidden="true">
            <label for="cf-website">Website</label>
            <input id="cf-website" name="website" type="text" tabindex="-1" autocomplete="off">
          </div>
          <div class="field full check">
            <label><input type="checkbox" name="consent" value="1" required><span>I have read the <a href="/privacy.html">Privacy Policy</a> and agree to AdVanishly using these details to reply to my message.</span></label>
            <?php if (isset($errors['consent'])): ?><small class="field-err"><?= e($errors['consent']); ?></small><?php endif; ?>
          </div>
          <div class="field full">
            <button type="submit" class="btn btn-solid">Send Message
              <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M22 2L11 13M22 2l-7 20-4-9-9-4z"/></svg>
            </button>
          </div>
        </form>

        <h2>Response Times</h2>
        <p>We aim to respond to inquiries within a few business days. Including the address of the page you are writing about helps us reply more quickly.</p>
        <h2>Questions About Total Adblock</h2>
        <p>AdVanishly publishes advertorial content and does not manage accounts, subscriptions, payments or refunds for the products we feature. For questions about installation, billing, cancellation or refunds, please contact Total Adblock directly through its official website.</p>
      </article>
    </div>
  </section>
</main>

<footer class="site-footer">
  <div class="wrap">
    <div class="footer-top">
      <div class="footer-brand">
        <a href="/index.html"><img src="images/logo.png" alt="AdVanishly" width="186" height="52" loading="lazy"></a>
        <p>AdVanishly publishes plain-language explainers about web clutter, pop-ups, trackers and calmer browsing, including sponsored coverage of the Total Adblock Browser Extension.</p>
      </div>
      <nav class="footer-links" aria-label="Footer">
        <a href="/index.html">Home</a>
        <a href="/about.html">About</a>
        <a href="/contact.html">Contact</a>
        <a href="/disclaimer.html">Disclaimer</a>
        <a href="/privacy.html">Privacy Policy</a>
        <a href="/terms.html">Terms and Conditions</a>
      </nav>
      <address class="footer-id">
        <strong>Dynamic Graphics</strong>
        300 Boone Rd Ste A9<br>Burleson, TX 76028<br>United States<br>
        <a href="tel:+18174548488">+1 817 454 8488</a>
      </address>
    </div>
    <div class="footer-bottom">
      <p>&copy; 2026 All rights reserved.</p>
      <p>Total Adblock is a trademark of its respective owner. AdVanishly is not affiliated with, endorsed by, or acting on behalf of the provider.</p>
    </div>
  </div>
</footer>

</body>
</html>
