<?php
// ✅ Enable error reporting during development
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require_once 'db.php';

// ✅ Fetch Branding Details
$stmt = $pdo->query("SELECT * FROM branding WHERE id = 1");
$branding = $stmt->fetch(PDO::FETCH_ASSOC);
$brandName = $branding['brand_name'] ?? 'Marketing System';
$logoImage = $branding['logo_image'] ?? '';
$footerNote = $branding['footer_note'] ?? '';
$domainName = str_replace(['https://', 'http://', 'www.'], '', $_SERVER['HTTP_HOST']);
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Income Disclaimer - <?= htmlspecialchars($brandName); ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css">
    <style>
        body {
            padding: 30px;
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
        }
        .container {
            background: #fff;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 0 15px rgba(0,0,0,0.1);
        }
        .logo {
            max-height: 80px;
            margin-bottom: 20px;
        }
        footer {
            margin-top: 60px;
            text-align: center;
            font-size: 14px;
            color: #777;
        }
    </style>
</head>
<body>

<div class="container">
    <?php if (!empty($logoImage)): ?>
        <div class="text-center">
            <img src="<?= htmlspecialchars($logoImage); ?>" alt="Logo" class="logo">
        </div>
    <?php endif; ?>

    <h1 class="text-center mb-4">Income Disclaimer</h1>
    <p><strong>Last Updated:</strong> July 04, 2025</p>

    <p>The <?= htmlspecialchars($brandName); ?> platform, available at <?= htmlspecialchars($domainName); ?>, is a marketing tool that supports affiliate and network marketers in building their business. We make no income guarantees or earnings claims.</p>

    <h4>1. Earnings Are Not Guaranteed</h4>
    <p>Any earnings or income statements shared within this platform, training, or by members are purely illustrative. Your individual results will vary and depend entirely on your own effort, skill, consistency, and external factors.</p>

    <h4>2. No Promised Results</h4>
    <p>While we showcase real testimonials or use-cases, they are based on specific effort and should not be considered typical. There is no promise that you will earn anything by using this system or promoting any of the included programs.</p>

    <h4>3. Risk Disclosure</h4>
    <p>Any time you join, upgrade, or spend money with a third-party program promoted within this system, you do so at your own risk. We do not offer refunds, guarantees, or support for external income streams. Read their terms carefully before participating.</p>

    <h4>4. We Are Affiliates, Not Owners</h4>
    <p><?= htmlspecialchars($brandName); ?> does not own or operate the income programs shown within the dashboard. We act as independent affiliates and cannot be held responsible for changes, delays, or commissions associated with those platforms.</p>

    <h4>5. Testimonials and User Feedback</h4>
    <p>Testimonials provided by users may not be verified. Even if real, they are not a guarantee that you will experience similar results. Use them for inspiration, not prediction.</p>

    <h4>6. Member Conduct</h4>
    <p>Members are expected to share disclaimers when promoting their referral links and to avoid overhyping or misleading claims. Misuse of testimonials or marketing materials may result in account suspension.</p>

    <h4>7. Your Responsibility</h4>
    <p>You are solely responsible for your business decisions, promotions, and how you present your affiliate links. Do your due diligence, stay compliant, and make informed choices.</p>

    <h4>8. Contact</h4>
    <p>If you have questions about this disclaimer or how the system operates, please contact us through the support page at <?= htmlspecialchars($domainName); ?>.</p>
</div>

<footer>
    <?= $footerNote ?: "&copy; $domainName. All rights reserved." ?>
</footer>

</body>
</html>
