MOON
Server: Apache
System: Linux server1.primemusicproductions.com 4.18.0-477.27.2.el8_8.x86_64 #1 SMP Fri Sep 29 08:21:01 EDT 2023 x86_64
User: primrwxj (1001)
PHP: 8.3.3
Disabled: NONE
Upload Files
File: //home/primrwxj/theproviders.info/index.php
<?php
// ============================================
// theproviders.info - Murfreesboro Roof Repair
// Version A (Control): Clean + Fast + Trusted
// - Sends lead to offers@theproviders.info
// - Logs to /leads/leads.csv
// - Redirects to /thank-you.php on success
// ============================================

/** CONFIG **/
$site_name     = "theproviders.info";
$city_label    = "Murfreesboro, TN";
$service_label = "Roof Repair";

$to_email      = "offers@theproviders.info";
$from_email    = "no-reply@theproviders.info";

$lead_csv_dir  = __DIR__ . "/leads";
$lead_csv_file = $lead_csv_dir . "/leads.csv";

// Create leads directory if missing
if (!is_dir($lead_csv_dir)) { 
    @mkdir($lead_csv_dir, 0755, true); 
    // Set permissions explicitly
    @chmod($lead_csv_dir, 0755);
}

// Helpers
function clean($v){
    $v = trim((string)$v);
    return str_replace(["\r","\n"]," ",$v);
}

function is_valid_email($email){
    return (bool)filter_var($email, FILTER_VALIDATE_EMAIL);
}

$error_msg = "";

// Handle POST
if ($_SERVER["REQUEST_METHOD"] === "POST") {

    // Anti-spam
    $hp  = clean($_POST["company"] ?? "");
    $ts  = (int)($_POST["form_ts"] ?? 0);
    $now = time();

    if ($hp !== "") {
        $error_msg = "Submission blocked.";
    } elseif ($ts === 0 || ($now - $ts) < 3) {
        $error_msg = "Please try again.";
    } else {

        $full_name = clean($_POST["full_name"] ?? "");
        $phone     = clean($_POST["phone"] ?? "");
        $email     = clean($_POST["email"] ?? "");
        $zip       = clean($_POST["zip"] ?? "");
        $issue     = clean($_POST["issue"] ?? "");
        $urgency   = clean($_POST["urgency"] ?? "");

        $allowed_issues = [
            "Roof leak",
            "Storm / wind damage",
            "Missing or damaged shingles",
            "Sagging roof",
            "Emergency repair",
            "Inspection only"
        ];
        $allowed_urgency = ["ASAP","This week","Flexible"];

        $errors = [];
        if ($full_name === "" || strlen($full_name) < 2) $errors[] = "Enter your full name.";
        if ($phone === "" || strlen($phone) < 7) $errors[] = "Enter a valid phone number.";
        if ($email === "" || !is_valid_email($email)) $errors[] = "Enter a valid email.";
        if ($zip === "" || !preg_match("/^\d{5}(-\d{4})?$/", $zip)) $errors[] = "Enter a valid ZIP code.";
        if (!in_array($issue, $allowed_issues, true)) $errors[] = "Choose an issue.";
        if (!in_array($urgency, $allowed_urgency, true)) $errors[] = "Choose a timeframe.";

        if ($errors) {
            $error_msg = implode(" ", $errors);
        } else {

            // Email content
            $subject = "[Lead] Roof Repair - Murfreesboro ($issue, $urgency)";
            $body =
                "New Lead from $site_name\n"
                . "---------------------------------\n"
                . "Service: $service_label\n"
                . "City: $city_label\n"
                . "Name: $full_name\n"
                . "Phone: $phone\n"
                . "Email: $email\n"
                . "ZIP: $zip\n"
                . "Issue: $issue\n"
                . "Urgency: $urgency\n"
                . "IP: " . ($_SERVER["REMOTE_ADDR"] ?? "unknown") . "\n"
                . "Submitted: " . date("Y-m-d H:i:s") . "\n";

            $headers = [
                "From: $site_name <$from_email>",
                "Reply-To: $full_name <$email>",
                "Content-Type: text/plain; charset=UTF-8"
            ];

            $mail_ok = @mail($to_email, $subject, $body, implode("\r\n", $headers));

            // Log CSV
            $csv_ok = false;
            $is_new = !file_exists($lead_csv_file);

            if ($fp = @fopen($lead_csv_file, "a")) {
                if ($is_new) {
                    fputcsv($fp, ["timestamp","service","city","full_name","phone","email","zip","issue","urgency","ip","variant"]);
                }
                fputcsv($fp, [
                    date("c"),
                    $service_label,
                    $city_label,
                    $full_name,
                    $phone,
                    $email,
                    $zip,
                    $issue,
                    $urgency,
                    ($_SERVER["REMOTE_ADDR"] ?? ""),
                    "A"
                ]);
                fclose($fp);
                $csv_ok = true;
            }

            if ($mail_ok || $csv_ok) {
                header("Location: /thank-you.php?v=A");
                exit;
            } else {
                $error_msg = "We couldn't send your request right now. Please try again.";
            }
        }
    }
}
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Roof Repair in Murfreesboro, TN | theproviders.info</title>
    <meta name="description" content="Get a fast quote for roof repair in Murfreesboro, TN. Leaks, storm damage, missing shingles, emergency repairs.">
    <style>
    :root{
        --bg:#ffffff;
        --ink:#0f172a;
        --muted:#475569;
        --line:#e2e8f0;
        --card:#ffffff;
        --accent:#1d4ed8;
        --accent2:#0f766e;
        --danger:#b91c1c;
        --radius:16px;
        --shadow: 0 10px 25px rgba(15, 23, 42, .08);
        --max: 1080px;
    }
    *{box-sizing:border-box}
    body{
        margin:0; 
        font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
        background: linear-gradient(180deg, #ffffff, #f8fafc);
        color:var(--ink);
        min-height: 100vh;
    }
    .wrap{
        max-width:var(--max); 
        margin:0 auto; 
        padding:28px 16px 60px
    }
    .top{
        display:flex; 
        justify-content:space-between; 
        align-items:center; 
        gap:12px; 
        padding:8px 0 22px
    }
    .brand{
        font-weight:900; 
        letter-spacing:.2px;
        font-size: 1.25rem;
    }
    .pill{
        border:1px solid var(--line); 
        padding:8px 12px; 
        border-radius:999px; 
        color:var(--muted); 
        font-size:14px; 
        background:#fff;
        white-space: nowrap;
    }
    .grid{
        display:grid; 
        grid-template-columns: 1.15fr .85fr; 
        gap:28px
    }
    @media (max-width: 900px){ 
        .grid{
            grid-template-columns:1fr;
            gap: 24px;
        } 
    }

    .card{
        background:var(--card);
        border:1px solid var(--line);
        border-radius:var(--radius);
        box-shadow:var(--shadow);
        overflow:hidden;
    }
    .hero{
        padding:28px 24px
    }
    h1{
        margin:0 0 12px; 
        font-size:clamp(28px,4vw,40px); 
        line-height:1.15;
        font-weight: 800;
    }
    .sub{
        color:var(--muted); 
        margin:0 0 16px; 
        line-height:1.65;
        font-size: 1.05rem;
    }
    .bullets{
        margin:20px 0 0; 
        padding:0; 
        list-style:none; 
        display:grid; 
        gap:12px
    }
    .bullets li{
        padding:14px 16px;
        border:1px solid var(--line);
        border-radius:12px;
        background:#f8fafc;
        color:var(--ink);
        font-size: 0.95rem;
    }
    .badge{
        display:inline-flex; 
        gap:8px; 
        align-items:center;
        background:#ecfdf5;
        border:1px solid #a7f3d0;
        color:#065f46;
        padding:8px 12px;
        border-radius:999px;
        font-size:14px;
        margin-bottom:16px;
        font-weight:700;
    }
    .section{
        padding:22px 24px; 
        border-top:1px solid var(--line)
    }
    .section h3{
        margin:0 0 12px; 
        font-size:20px;
        font-weight: 700;
    }
    .section ul{
        margin:12px 0 0; 
        padding-left:20px; 
        color:var(--muted); 
        line-height:1.75;
        font-size: 0.95rem;
    }
    .section li{
        margin-bottom: 8px;
    }

    .form{
        padding:28px 24px
    }
    .form h2{
        margin:0 0 12px; 
        font-size:24px;
        font-weight: 700;
    }
    .form p{
        margin:0 0 20px; 
        color:var(--muted); 
        line-height:1.65;
        font-size: 1rem;
    }
    .row{
        display:grid; 
        grid-template-columns:1fr 1fr; 
        gap:16px
    }
    @media (max-width:560px){ 
        .row{
            grid-template-columns:1fr;
            gap: 12px;
        } 
    }
    label{
        display:block; 
        font-size:14px; 
        color:var(--muted); 
        margin:12px 0 8px;
        font-weight: 500;
    }

    input,select{
        width:100%;
        padding:14px 16px;
        border-radius:12px;
        border:1px solid var(--line);
        background:#ffffff;
        color:var(--ink);
        outline:none;
        font-size: 16px;
        transition: all 0.2s ease;
    }
    input:focus, select:focus{
        border-color: rgba(29,78,216,.65);
        box-shadow: 0 0 0 3px rgba(29,78,216,.15);
    }

    .btn{
        width:100%;
        padding:16px;
        border-radius:14px;
        border:1px solid rgba(29,78,216,.35);
        background: linear-gradient(180deg, rgba(29,78,216,1), rgba(29,78,216,.88));
        color:#fff;
        font-weight:800;
        cursor:pointer;
        margin-top:20px;
        font-size: 16px;
        transition: all 0.2s ease;
    }
    .btn:hover{
        filter:brightness(1.05);
        transform: translateY(-1px);
    }
    .note{
        font-size:13px; 
        color:var(--muted); 
        margin-top:16px; 
        line-height:1.6
    }

    .alert{
        margin:0 0 20px; 
        padding:14px 16px; 
        border-radius:12px; 
        border:1px solid var(--line); 
        background:#f8fafc; 
        line-height:1.55;
        font-size: 15px;
    }
    .alert.err{
        border-color: rgba(185,28,28,.25); 
        background: rgba(185,28,28,.05); 
        color:#7f1d1d;
        font-weight: 500;
    }

    .hp{
        position:absolute; 
        left:-9999px; 
        top:-9999px; 
        height:0; 
        width:0; 
        overflow:hidden
    }

    footer{
        max-width:var(--max); 
        margin:40px auto 0; 
        padding:0 16px; 
        color:var(--muted); 
        font-size:13px; 
        line-height:1.6;
        text-align: center;
    }
    footer a{
        color:var(--ink);
        text-decoration: underline;
    }
    footer strong{
        color: var(--ink);
    }
    
    /* Form repopulation on error */
    input[type="text"],
    input[type="tel"],
    input[type="email"] {
        value: "<?php echo isset($_POST['full_name']) ? htmlspecialchars($_POST['full_name']) : ''; ?>";
    }
    
    .success-msg {
        display: none;
    }
</style>

</head>
<body>
    <div class="wrap">
        <div class="top">
            <div class="brand">theproviders.info</div>
            <div class="pill">Serving <strong>Murfreesboro, TN</strong></div>
        </div>

        <div class="grid">
            <div class="card">
                <div class="hero">
                    <div class="badge">Local Requests • Fast Response • No Pressure</div>
                    <h1>Roof Repair in Murfreesboro, TN — Get a Fast, Local Quote Today</h1>
                    <p class="sub">Leaks, storm damage, missing shingles, and emergency repairs. Submit a quick request and a local roofer can contact you soon.</p>
                    <ul class="bullets">
                        <li>Local roofers serving Murfreesboro & Rutherford County</li>
                        <li>Emergency tarping and fast leak mitigation options</li>
                        <li>Free to request — you choose who to work with</li>
                    </ul>
                </div>
                <div class="section">
                    <h3>Common Roof Problems We Help With</h3>
                    <ul>
                        <li>Active leaks and water intrusion</li>
                        <li>Storm / wind damage assessments</li>
                        <li>Damaged or missing shingles</li>
                        <li>Flashing, vent, and chimney sealing</li>
                        <li>Emergency temporary protection</li>
                    </ul>
                </div>
                <div class="section">
                    <h3>Why Homeowners Use Us</h3>
                    <ul>
                        <li>Faster than calling multiple roofers</li>
                        <li>Requests routed by ZIP code</li>
                        <li>No obligation — compare options</li>
                    </ul>
                </div>
            </div>

            <div class="card">
                <div class="form">
                    <h2>Request a Roof Repair Quote</h2>
                    <p>Share the issue + ZIP — we'll route your request to local roof repair providers.</p>

                    <?php if ($error_msg): ?>
                        <div class="alert err"><?php echo htmlspecialchars($error_msg); ?></div>
                    <?php endif; ?>

                    <form method="post" action="">
                        <div class="hp">
                            <label>Company</label>
                            <input type="text" name="company" tabindex="-1" autocomplete="off" />
                        </div>
                        <input type="hidden" name="form_ts" value="<?php echo time(); ?>">

                        <label for="full_name">Full Name *</label>
                        <input id="full_name" name="full_name" type="text" placeholder="e.g., John Smith" required value="<?php echo isset($_POST['full_name']) ? htmlspecialchars($_POST['full_name']) : ''; ?>">

                        <div class="row">
                            <div>
                                <label for="phone">Phone Number *</label>
                                <input id="phone" name="phone" type="tel" placeholder="e.g., (615) 555-1234" required value="<?php echo isset($_POST['phone']) ? htmlspecialchars($_POST['phone']) : ''; ?>">
                            </div>
                            <div>
                                <label for="email">Email *</label>
                                <input id="email" name="email" type="email" placeholder="e.g., you@email.com" required value="<?php echo isset($_POST['email']) ? htmlspecialchars($_POST['email']) : ''; ?>">
                            </div>
                        </div>

                        <div class="row">
                            <div>
                                <label for="zip">ZIP Code *</label>
                                <input id="zip" name="zip" type="text" placeholder="e.g., 37129" required value="<?php echo isset($_POST['zip']) ? htmlspecialchars($_POST['zip']) : ''; ?>">
                            </div>
                            <div>
                                <label for="urgency">When do you need service? *</label>
                                <select id="urgency" name="urgency" required>
                                    <option value="" selected disabled>Select one</option>
                                    <option value="ASAP" <?php echo (isset($_POST['urgency']) && $_POST['urgency'] == 'ASAP') ? 'selected' : ''; ?>>ASAP</option>
                                    <option value="This week" <?php echo (isset($_POST['urgency']) && $_POST['urgency'] == 'This week') ? 'selected' : ''; ?>>This week</option>
                                    <option value="Flexible" <?php echo (isset($_POST['urgency']) && $_POST['urgency'] == 'Flexible') ? 'selected' : ''; ?>>Flexible</option>
                                </select>
                            </div>
                        </div>

                        <label for="issue">What's the issue? *</label>
                        <select id="issue" name="issue" required>
                            <option value="" selected disabled>Select one</option>
                            <option value="Roof leak" <?php echo (isset($_POST['issue']) && $_POST['issue'] == 'Roof leak') ? 'selected' : ''; ?>>Roof leak</option>
                            <option value="Storm / wind damage" <?php echo (isset($_POST['issue']) && $_POST['issue'] == 'Storm / wind damage') ? 'selected' : ''; ?>>Storm / wind damage</option>
                            <option value="Missing or damaged shingles" <?php echo (isset($_POST['issue']) && $_POST['issue'] == 'Missing or damaged shingles') ? 'selected' : ''; ?>>Missing or damaged shingles</option>
                            <option value="Sagging roof" <?php echo (isset($_POST['issue']) && $_POST['issue'] == 'Sagging roof') ? 'selected' : ''; ?>>Sagging roof</option>
                            <option value="Emergency repair" <?php echo (isset($_POST['issue']) && $_POST['issue'] == 'Emergency repair') ? 'selected' : ''; ?>>Emergency repair</option>
                            <option value="Inspection only" <?php echo (isset($_POST['issue']) && $_POST['issue'] == 'Inspection only') ? 'selected' : ''; ?>>Inspection only</option>
                        </select>

                        <button class="btn" type="submit">Get My Quote</button>

                        <div class="note">
                            By submitting, you agree to be contacted by independent local roof repair providers about your request. This site is not a roofing contractor.
                            <br>Read our <a href="https://theproviders.info/privacy-policy.html">privacy note</a>.
                        </div>
                    </form>
                </div>

                <div class="section">
                    <h3>FAQ</h3>
                    <ul>
                        <li><strong>Is this a roofing company?</strong> No — we connect you with independent local roofers.</li>
                        <li><strong>How fast will someone respond?</strong> Often same-day for urgent issues.</li>
                        <li><strong>Is it free?</strong> Yes — requesting a quote is free.</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <footer>
        <strong>Disclaimer:</strong> TheProviders.info connects homeowners with independent contractors. Pricing, warranties, and availability are determined by the contractor. If you have a dangerous structural situation or emergency, call local emergency services.
    </footer>
</body>
</html>