File: /home/primrwxj/the-therapy.info/index.php
<?php
declare(strict_types=1);
session_start();
/**
* the-therapy.info — Intake Routing Landing Page + Exit Intent + Thank-you redirect
* Files:
* - index.php
* - thank-you.php
* - privacy.php
*
* Setup:
* 1) Put these files in the same folder on your server
* 2) Ensure /leads folder exists + is writable (same directory): /leads/leads.csv
* 3) Update settings below
*/
// Force HTTPS (behind proxies/CDNs too)
$isHttps = (
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (isset($_SERVER['SERVER_PORT']) && (int)$_SERVER['SERVER_PORT'] === 443)
|| (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
);
if (!$isHttps) {
$host = $_SERVER['HTTP_HOST'] ?? '';
$uri = $_SERVER['REQUEST_URI'] ?? '/';
header("Location: https://{$host}{$uri}", true, 301);
exit;
}
$siteName = "The-Therapy.Info";
$host = $_SERVER['HTTP_HOST'] ?? 'the-therapy.info';
// Contact (display as buttons only; do not print raw email to reduce scraping)
$publicPhoneDisplay = "(615) 624-4157";
$publicPhoneTel = "16156244157"; // tel: format
$leadEmailInbox = "leads@the-therapy.info"; // used for internal mail() only
// Positioning: "intake_routing" is safest language for what you're doing
$positioning = "intake_routing"; // options: intake_routing | directory | referral
function h(string $s): string { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); }
function now_iso(): string { return (new DateTime('now', new DateTimeZone('UTC')))->format(DateTimeInterface::ATOM); }
// CSRF token
if (empty($_SESSION['csrf'])) $_SESSION['csrf'] = bin2hex(random_bytes(24));
// Simple rate limit (per session)
if (!isset($_SESSION['last_submit_ts'])) $_SESSION['last_submit_ts'] = 0;
$errors = [];
// Categories (chips)
$categoryOptions = [
"Anxiety",
"Depression",
"Trauma / PTSD",
"Couples / Marriage",
"Family Therapy",
"Grief / Loss",
"Stress / Burnout",
"EMDR",
"Faith-based",
"Men’s Issues",
"Women’s Issues",
"Addiction / Substance Use",
"Life Transitions",
"ADHD / Focus",
"Anger Management"
];
// Copy blocks by positioning
function positioning_copy(string $mode): array {
if ($mode === 'directory') {
return [
"headline" => "Find a therapist — with a clearer first step.",
"sub" => "Share what you’re looking for. We’ll use your answers to help you identify therapists that match your needs and preferences.",
"cred" => "We’re a directory-style matching service. We help you narrow options and connect to providers, but you choose whether to proceed."
];
}
if ($mode === 'referral') {
return [
"headline" => "Get connected to a therapist who fits your needs.",
"sub" => "Tell us what you’re looking for and we’ll route your request to a provider or clinic that may be a good fit based on availability and specialty.",
"cred" => "We help route your request to an appropriate provider. Final clinical decisions and scheduling are handled by the provider."
];
}
// intake_routing default
return [
"headline" => "Start therapy with less overwhelm.",
"sub" => "Answer a few quick questions. We’ll route your request to the right next step based on specialty, availability, and your preferences.",
"cred" => "This is an intake routing service designed to reduce friction and help you get to the right provider faster."
];
}
$copy = positioning_copy($positioning);
// Handle POST
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Rate limit: 1 submission per 30 seconds per session
if (time() - (int)$_SESSION['last_submit_ts'] < 30) $errors[] = "Please wait a moment and try again.";
// CSRF check
$postedCsrf = (string)($_POST['csrf'] ?? '');
if (!hash_equals($_SESSION['csrf'], $postedCsrf)) $errors[] = "Security check failed. Please refresh and try again.";
// Honeypot
$company = trim((string)($_POST['company'] ?? ''));
if ($company !== '') $errors[] = "Submission blocked.";
// Collect
$full_name = trim((string)($_POST['full_name'] ?? ''));
$email = trim((string)($_POST['email'] ?? ''));
$phone = trim((string)($_POST['phone'] ?? ''));
$zip = trim((string)($_POST['zip'] ?? ''));
$state = trim((string)($_POST['state'] ?? ''));
$contact = trim((string)($_POST['contact_method'] ?? 'Call'));
$availability = trim((string)($_POST['availability'] ?? 'Weekdays (Daytime)'));
$insurance = trim((string)($_POST['insurance'] ?? ''));
$concern = trim((string)($_POST['concern'] ?? ''));
$consent = (string)($_POST['consent'] ?? '');
// Categories multi-select
$categories = $_POST['categories'] ?? [];
if (!is_array($categories)) $categories = [];
// keep only allowed
$categories = array_values(array_filter($categories, fn($c) => in_array($c, $categoryOptions, true)));
// Validate
if ($full_name === '' || mb_strlen($full_name) < 2) $errors[] = "Please enter your name.";
if ($email === '' || !filter_var($email, FILTER_VALIDATE_EMAIL)) $errors[] = "Please enter a valid email.";
if ($phone === '' || mb_strlen(preg_replace('/\D+/', '', $phone)) < 10) $errors[] = "Please enter a valid phone number.";
if ($consent !== 'yes') $errors[] = "Please confirm consent so we can contact you.";
if (count($categories) === 0) $errors[] = "Please choose at least one category (so we can match you better).";
$allowedContact = ['Call', 'Text', 'Email'];
if (!in_array($contact, $allowedContact, true)) $contact = 'Call';
if (!$errors) {
$_SESSION['last_submit_ts'] = time();
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
$ref = $_SERVER['HTTP_REFERER'] ?? '';
$timestamp = now_iso();
$leadId = substr(bin2hex(random_bytes(8)), 0, 12);
$row = [
$timestamp,
$leadId,
$full_name,
$email,
$phone,
$zip,
$state,
$contact,
$availability,
implode('; ', $categories),
$insurance,
$concern,
$consent,
$ip,
$ua,
$ref
];
// Save to CSV
$dir = __DIR__ . DIRECTORY_SEPARATOR . "leads";
$csv = $dir . DIRECTORY_SEPARATOR . "leads.csv";
if (!is_dir($dir)) @mkdir($dir, 0755, true);
$isNew = !file_exists($csv);
$fp = @fopen($csv, 'ab');
if (!$fp) {
$errors[] = "We couldn't save your request right now. Please try again shortly.";
} else {
if ($isNew) {
fputcsv($fp, [
"timestamp_utc","lead_id","name","email","phone","zip","state",
"preferred_contact","availability","categories","insurance","concern",
"consent","ip","user_agent","referrer"
]);
}
fputcsv($fp, $row);
fclose($fp);
}
// Email lead to your inbox (internal)
if (!$errors) {
$subject = "New Intake Request — {$siteName} ({$leadId})";
$message =
"New intake request received:\n\n"
. "Lead ID: {$leadId}\n"
. "Name: {$full_name}\n"
. "Email: {$email}\n"
. "Phone: {$phone}\n"
. "ZIP/State: {$zip} / {$state}\n"
. "Preferred contact: {$contact}\n"
. "Availability: {$availability}\n"
. "Categories: " . implode(', ', $categories) . "\n"
. "Insurance: {$insurance}\n"
. "Concern: {$concern}\n"
. "Consent: {$consent}\n\n"
. "Timestamp (UTC): {$timestamp}\n"
. "IP: {$ip}\n"
. "Referrer: {$ref}\n";
// NOTE: mail() reliability varies by host. For best deliverability, use SMTP (PHPMailer) later.
$headers =
"From: {$siteName} <no-reply@{$host}>\r\n"
. "Reply-To: {$email}\r\n";
@mail($leadEmailInbox, $subject, $message, $headers);
// Rotate CSRF
$_SESSION['csrf'] = bin2hex(random_bytes(24));
// Separate consent log (append-only)
$consentDir = __DIR__ . DIRECTORY_SEPARATOR . "leads";
$consentLog = $consentDir . DIRECTORY_SEPARATOR . "consent-log.csv";
$consentRow = [
$timestamp, // UTC timestamp
$leadId,
$full_name,
$email,
$phone,
"yes", // consent value
$ip,
$contact, // preferred contact
"intake_form_v1"
];
$fp2 = @fopen($consentLog, 'ab');
if ($fp2) {
if (!file_exists($consentLog) || filesize($consentLog) === 0) {
fputcsv($fp2, ["timestamp_utc","lead_id","name","email","phone","consent","ip","preferred_contact","form_version"]);
}
fputcsv($fp2, $consentRow);
fclose($fp2);
}
// Redirect to thank-you page (prevents resubmit on refresh)
$basePath = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$basePath = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
header("Location: {$basePath}/thank-you.php?id=" . urlencode($leadId));
exit;
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title><?= h($siteName) ?> — Intake Request</title>
<meta name="description" content="Private, calming, and supportive intake routing. Tell us what you’re looking for and we’ll help you take the next step."/>
<style>
:root{
--bg1:#f7fbff;
--bg2:#eef6ff;
--ink:#0b1b2a;
--muted:#4b5a68;
--card:rgba(255,255,255,.72);
--line:rgba(14, 35, 56, .12);
--brand:#2c7a7b;
--brand2:#5a67d8;
--shadow:0 18px 55px rgba(12, 28, 48, .14);
--radius:18px;
}
*{box-sizing:border-box}
body{
margin:0;
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
color:var(--ink);
background:
radial-gradient(1100px 700px at 18% 20%, rgba(90,103,216,.16), transparent 55%),
radial-gradient(900px 650px at 78% 22%, rgba(44,122,123,.14), transparent 52%),
radial-gradient(900px 650px at 30% 85%, rgba(236,72,153,.08), transparent 55%),
linear-gradient(180deg, var(--bg1), var(--bg2));
min-height:100vh;
overflow-x:hidden;
}
.floral{
position:fixed; inset:0;
pointer-events:none;
opacity:.22;
background-image:
radial-gradient(circle at 12px 12px, rgba(44,122,123,.22) 2px, transparent 3px),
radial-gradient(circle at 42px 38px, rgba(90,103,216,.18) 2px, transparent 3px),
radial-gradient(circle at 65px 18px, rgba(16,185,129,.12) 2px, transparent 3px);
background-size: 90px 90px;
filter: blur(.2px);
}
.wrap{max-width:1080px; margin:0 auto; padding:34px 16px 60px;}
.topbar{
display:flex; align-items:center; justify-content:space-between;
gap:14px; padding:12px 6px; margin-bottom:10px;
}
.brand{
display:flex; align-items:center; gap:10px;
font-weight:800; letter-spacing:.2px;
}
.logo{
width:38px; height:38px; border-radius:12px;
background: linear-gradient(135deg, rgba(44,122,123,.95), rgba(90,103,216,.9));
box-shadow: 0 10px 25px rgba(44,122,123,.22);
position:relative;
}
.logo:after{
content:"";
position:absolute; inset:9px;
border-radius:10px;
border:1px solid rgba(255,255,255,.65);
transform: rotate(8deg);
}
.top-actions{
display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end;
}
.glowBtn{
display:inline-flex; align-items:center; justify-content:center;
gap:8px;
padding:10px 14px;
border-radius:999px;
border:1px solid rgba(255,255,255,.55);
background: linear-gradient(135deg, rgba(44,122,123,.92), rgba(90,103,216,.90));
color:#fff;
text-decoration:none;
font-weight:800;
box-shadow: 0 14px 35px rgba(44,122,123,.20);
backdrop-filter: blur(10px);
transition: transform .08s ease, filter .12s ease;
cursor:pointer;
}
.glowBtn:hover{filter:brightness(1.05)}
.glowBtn:active{transform: translateY(1px)}
.ghostBtn{
display:inline-flex; align-items:center; justify-content:center;
padding:10px 14px;
border-radius:999px;
border:1px solid rgba(14,35,56,.14);
background: rgba(255,255,255,.62);
color: rgba(11,27,42,.9);
text-decoration:none;
font-weight:800;
box-shadow: 0 10px 25px rgba(12, 28, 48, .08);
cursor:pointer;
}
.grid{
display:grid;
grid-template-columns: 1.1fr .9fr;
gap:18px;
margin-top:14px;
}
@media (max-width: 920px){
.grid{grid-template-columns:1fr; }
.topbar{align-items:flex-start}
}
.hero{
padding:22px;
border-radius: var(--radius);
background: rgba(255,255,255,.55);
border:1px solid var(--line);
box-shadow: var(--shadow);
backdrop-filter: blur(12px);
}
h1{margin:0 0 10px; font-size:34px; line-height:1.1}
.sub{margin:0 0 18px; color:var(--muted); font-size:16px; line-height:1.65}
.trust{
display:grid;
grid-template-columns: 1fr 1fr;
gap:12px;
margin-top:14px;
}
@media (max-width: 520px){ .trust{grid-template-columns:1fr;} }
.tcard{
border:1px solid var(--line);
background: rgba(255,255,255,.65);
border-radius:16px;
padding:14px;
}
.tcard b{display:block; margin-bottom:6px}
.tcard p{margin:0; color:var(--muted); line-height:1.55; font-size:14px}
.formcard{
padding:18px;
border-radius: var(--radius);
background: var(--card);
border:1px solid var(--line);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
}
.formcard h2{margin:0 0 10px; font-size:18px}
.formcard .note{margin:0 0 12px; color:var(--muted); font-size:14px; line-height:1.55}
.error{
border:1px solid rgba(239,68,68,.35);
background: rgba(239,68,68,.08);
padding:12px 12px;
border-radius:14px;
margin:0 0 12px;
}
ul{margin:8px 0 0 18px; color:#7a1c1c}
.field{margin:10px 0}
label{display:block; font-size:13px; color:var(--muted); margin-bottom:6px}
input, select, textarea{
width:100%;
padding:12px 12px;
border-radius:14px;
border:1px solid rgba(14,35,56,.18);
background: rgba(255,255,255,.78);
outline:none;
font-size:14px;
}
textarea{min-height:92px; resize:vertical}
input:focus, select:focus, textarea:focus{
border-color: rgba(44,122,123,.55);
box-shadow: 0 0 0 4px rgba(44,122,123,.12);
}
.row{display:grid; grid-template-columns:1fr 1fr; gap:10px}
@media (max-width: 520px){ .row{grid-template-columns:1fr;} }
.btn{
width:100%;
border:none;
border-radius: 16px;
padding:14px 14px;
font-weight:900;
cursor:pointer;
color:white;
background: linear-gradient(135deg, rgba(44,122,123,.98), rgba(90,103,216,.95));
box-shadow: 0 14px 35px rgba(44,122,123,.22);
transition: transform .08s ease;
}
.btn:active{transform: translateY(1px)}
.consent{
display:flex; gap:10px; align-items:flex-start;
margin-top:10px;
padding:10px;
border-radius:14px;
border:1px dashed rgba(14,35,56,.18);
background: rgba(255,255,255,.55);
}
.consent input{width:auto; margin-top:3px}
.consent small{color:var(--muted); line-height:1.5}
.divider{height:1px; background:rgba(14,35,56,.10); margin:12px 0}
.footer{margin-top:12px; color:rgba(11,27,42,.62); font-size:12.5px; line-height:1.6;}
.footer a{color:rgba(11,27,42,.78)}
/* Chips */
.chips{
display:flex;
flex-wrap:wrap;
gap:8px;
}
.chip{
position:relative;
display:inline-flex;
align-items:center;
gap:8px;
padding:9px 12px;
border-radius:999px;
border:1px solid rgba(14,35,56,.14);
background: rgba(255,255,255,.66);
cursor:pointer;
user-select:none;
font-weight:800;
color: rgba(11,27,42,.9);
transition: transform .06s ease, box-shadow .12s ease, border-color .12s ease;
}
.chip input{position:absolute; opacity:0; pointer-events:none}
.chip[data-on="1"]{
border-color: rgba(44,122,123,.40);
box-shadow: 0 10px 25px rgba(44,122,123,.12);
background: linear-gradient(135deg, rgba(44,122,123,.12), rgba(90,103,216,.10));
}
.chip:active{transform: translateY(1px)}
/* Exit intent modal */
.modalBack{
position:fixed; inset:0;
background: rgba(3, 10, 18, .45);
display:none; align-items:center; justify-content:center;
padding:16px;
z-index: 9999;
}
.modal{
max-width:640px; width:100%;
border-radius: 22px;
background: rgba(255,255,255,.92);
border:1px solid rgba(255,255,255,.35);
box-shadow: 0 25px 80px rgba(0,0,0,.22);
padding:18px;
position:relative;
}
.modal h3{margin:0 0 8px; font-size:20px}
.modal p{margin:0 0 12px; color:var(--muted); line-height:1.6}
.x{
position:absolute; right:12px; top:12px;
width:36px; height:36px; border-radius:12px;
border:1px solid rgba(14,35,56,.16);
background: rgba(255,255,255,.7);
cursor:pointer;
font-weight:900;
}
.modal .row2{display:flex; gap:10px; flex-wrap:wrap}
.modal .ghost{
padding:12px 14px;
border-radius: 16px;
border:1px solid rgba(14,35,56,.16);
background: rgba(255,255,255,.65);
cursor:pointer;
font-weight:900;
color:rgba(11,27,42,.85);
text-decoration:none;
display:inline-flex;
align-items:center;
justify-content:center;
}
</style>
</head>
<body>
<div class="floral" aria-hidden="true"></div>
<div class="wrap">
<div class="topbar">
<div class="brand">
<div class="logo" aria-hidden="true"></div>
<div>
<div><?= h($siteName) ?></div>
<div style="font-size:12.5px;color:rgba(11,27,42,.65);font-weight:700;">
Private intake routing • Calm, respectful support
</div>
</div>
</div>
<div class="top-actions">
<a class="glowBtn" href="tel:<?= h($publicPhoneTel) ?>" aria-label="Call us">Call us</a>
<button class="ghostBtn" id="emailBtn" type="button" aria-label="Email us">Email us</button>
</div>
</div>
<div class="grid">
<section class="hero">
<h1><?= h($copy['headline']) ?></h1>
<p class="sub"><?= h($copy['sub']) ?></p>
<div class="trust">
<div class="tcard">
<b>What happens next</b>
<p>We review your request and respond within <b>1 business day</b> with next steps.</p>
</div>
<div class="tcard">
<b>Clinic-grade privacy approach</b>
<p>We collect the minimum needed to route your request and follow up. No spam. No selling your details.</p>
</div>
<div class="tcard">
<b>Not an emergency service</b>
<p>If you’re in immediate danger, call <b>911</b>. If you need urgent support, call/text <b>988</b> (US).</p>
</div>
<div class="tcard">
<b>How we describe this service</b>
<p><?= h($copy['cred']) ?></p>
</div>
</div>
<div class="divider"></div>
<div class="tcard">
<b>HIPAA-style note (plain English)</b>
<p>
We treat your information with care and limit access to what’s needed to respond. This site is not a hospital or insurer.
Unless you have a signed agreement with a provider, online forms and email may not be considered HIPAA-secure.
If you prefer, keep details general and share specifics during your provider session.
</p>
<p style="margin-top:10px;">
<a href="privacy.php" style="font-weight:900;">Read our Privacy Policy</a>
</p>
</div>
</section>
<aside class="formcard" id="request">
<h2>Request an intake match</h2>
<p class="note">This takes ~60 seconds. Choose categories so we can route you accurately.</p>
<?php if ($errors): ?>
<div class="error">
<b>Please fix the following:</b>
<ul>
<?php foreach ($errors as $e): ?>
<li><?= h($e) ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<form method="post" autocomplete="on" novalidate>
<input type="hidden" name="csrf" value="<?= h($_SESSION['csrf']) ?>"/>
<!-- Honeypot -->
<div style="position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden;">
<label>Company <input type="text" name="company" tabindex="-1" autocomplete="off"/></label>
</div>
<div class="field">
<label>Therapist categories (choose at least one)</label>
<div class="chips" id="chips">
<?php
$postedCats = $_POST['categories'] ?? [];
if (!is_array($postedCats)) $postedCats = [];
foreach ($categoryOptions as $cat):
$on = in_array($cat, $postedCats, true) ? '1' : '0';
?>
<label class="chip" data-on="<?= h($on) ?>">
<input type="checkbox" name="categories[]" value="<?= h($cat) ?>" <?= $on==='1'?'checked':'' ?>/>
<?= h($cat) ?>
</label>
<?php endforeach; ?>
</div>
</div>
<div class="field">
<label for="full_name">Your name</label>
<input id="full_name" name="full_name" placeholder="e.g., Jane D." required value="<?= h($_POST['full_name'] ?? '') ?>"/>
</div>
<div class="row">
<div class="field">
<label for="email">Email</label>
<input id="email" name="email" type="email" placeholder="you@example.com" required value="<?= h($_POST['email'] ?? '') ?>"/>
</div>
<div class="field">
<label for="phone">Phone</label>
<input id="phone" name="phone" inputmode="tel" placeholder="(555) 555-5555" required value="<?= h($_POST['phone'] ?? '') ?>"/>
</div>
</div>
<div class="row">
<div class="field">
<label for="zip">ZIP code</label>
<input id="zip" name="zip" inputmode="numeric" placeholder="e.g., 37129" value="<?= h($_POST['zip'] ?? '') ?>"/>
</div>
<div class="field">
<label for="state">State</label>
<input id="state" name="state" placeholder="e.g., TN" value="<?= h($_POST['state'] ?? '') ?>"/>
</div>
</div>
<div class="row">
<div class="field">
<label for="contact_method">Preferred contact</label>
<select id="contact_method" name="contact_method">
<?php
$cm = $_POST['contact_method'] ?? 'Call';
foreach (['Call','Text','Email'] as $opt) {
$sel = ($cm === $opt) ? 'selected' : '';
echo "<option {$sel}>".h($opt)."</option>";
}
?>
</select>
</div>
<div class="field">
<label for="availability">Best time to reach you</label>
<select id="availability" name="availability">
<?php
$av = $_POST['availability'] ?? 'Weekdays (Daytime)';
$opts = ['Weekdays (Morning)','Weekdays (Daytime)','Weekdays (Evening)','Weekends','Anytime'];
foreach ($opts as $opt) {
$sel = ($av === $opt) ? 'selected' : '';
echo "<option {$sel}>".h($opt)."</option>";
}
?>
</select>
</div>
</div>
<div class="field">
<label for="insurance">Insurance (optional)</label>
<input id="insurance" name="insurance" placeholder="e.g., Blue Cross, Aetna, Self-pay" value="<?= h($_POST['insurance'] ?? '') ?>"/>
</div>
<div class="field">
<label for="concern">What would you like help with? (keep it brief)</label>
<div style="font-size:12.5px;color:rgba(11,27,42,.62);margin:-2px 0 8px;line-height:1.5;">
Please avoid highly sensitive details online. You can share specifics directly with your therapist.
</div>
<textarea id="concern" name="concern" placeholder="A sentence or two is enough."></textarea>
</div>
<div class="consent">
<input id="consent" type="checkbox" name="consent" value="yes" <?= (($_POST['consent'] ?? '') === 'yes') ? 'checked' : '' ?> required/>
<small>
<b>I consent</b> to be contacted at the phone/email provided about this intake request.
Message/data rates may apply for texts. Reply STOP to opt out of texts.
We don’t sell your information.
</small>
</div>
<div class="field" style="margin-top:12px;">
<button class="btn" type="submit">Send my request</button>
</div>
<div class="footer">
<div class="divider"></div>
<div>
<b>Privacy:</b> We use your submission only to respond and route your request. See <a href="privacy.php">Privacy Policy</a>.
<br/>
<b>Emergency:</b> If you are in danger, call <b>911</b>. For immediate support, call/text <b>988</b>.
</div>
</div>
</form>
</aside>
</div>
</div>
<!-- Exit Intent Modal -->
<div class="modalBack" id="exitModal" role="dialog" aria-modal="true" aria-labelledby="exitTitle">
<div class="modal">
<button class="x" id="exitClose" aria-label="Close">×</button>
<h3 id="exitTitle">Before you go — want a calmer next step?</h3>
<p>
If you’re not ready to submit, that’s okay. You can either finish your request now, or view a short page on what to expect next.
</p>
<div class="row2">
<button class="btn" id="exitFinish" type="button" style="flex:1;">Finish my request</button>
<a class="ghost" id="exitRoute" href="privacy.php">See privacy & next steps</a>
</div>
<p style="margin-top:12px;font-size:13px;">
Prefer direct help? Use the <b>Call us</b> button for <?= h($publicPhoneDisplay) ?>.
</p>
</div>
</div>
<script>
(function(){
// CHIP UI: toggle data-on attribute to reflect checked state
const chipWrap = document.getElementById('chips');
if (chipWrap) {
chipWrap.addEventListener('click', (e) => {
const lbl = e.target.closest('.chip');
if (!lbl) return;
const cb = lbl.querySelector('input[type="checkbox"]');
if (!cb) return;
// clicking label will toggle checkbox automatically, but we update UI next tick
setTimeout(() => { lbl.dataset.on = cb.checked ? "1" : "0"; }, 0);
});
}
// Email button: do NOT print raw email in HTML; assemble it in JS to reduce scraping.
// This doesn't make it "impossible" to scrape, but it reduces basic bot harvesting.
const emailBtn = document.getElementById('emailBtn');
if (emailBtn) {
emailBtn.addEventListener('click', () => {
const user = "leads";
const domain = "the-therapy.info";
const addr = user + "@" + domain;
window.location.href = "mailto:" + addr + "?subject=" + encodeURIComponent("Intake request question");
});
}
// Exit intent logic:
const modal = document.getElementById('exitModal');
const closeBtn = document.getElementById('exitClose');
const finishBtn = document.getElementById('exitFinish');
const KEY = 'therapy_exit_shown_v2';
const alreadyShown = () => sessionStorage.getItem(KEY) === '1';
const markShown = () => sessionStorage.setItem(KEY, '1');
function openModal(){
if (alreadyShown()) return;
markShown();
modal.style.display = 'flex';
}
function closeModal(){
modal.style.display = 'none';
}
// Desktop: mouse leaves at top
document.addEventListener('mouseout', function(e){
if (alreadyShown()) return;
if (!e.relatedTarget && e.clientY <= 0) openModal();
});
// Mobile: visibility changes
document.addEventListener('visibilitychange', function(){
if (alreadyShown()) return;
if (document.visibilityState === 'hidden') {
sessionStorage.setItem(KEY + '_pending', '1');
} else {
if (sessionStorage.getItem(KEY + '_pending') === '1') {
sessionStorage.removeItem(KEY + '_pending');
openModal();
}
}
});
// Back button intercept
try {
history.pushState({exitIntent: true}, '');
window.addEventListener('popstate', function(){
if (alreadyShown()) return;
openModal();
history.pushState({exitIntent: true}, '');
});
} catch (e) {}
closeBtn.addEventListener('click', closeModal);
modal.addEventListener('click', function(e){
if (e.target === modal) closeModal();
});
finishBtn.addEventListener('click', function(){
closeModal();
const form = document.getElementById('request');
if (form) form.scrollIntoView({behavior:'smooth', block:'start'});
});
})();
</script>
</body>
<center>
<footer>
<div class="muted" style="margin-top:10px;">
<a href="privacy.php">Privacy</a> • <a href="legal.php">Terms & Disclaimer</a>
</div>
</center>
</footer>
</html>