<?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>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">Disclaimer</h1>
    <p><strong>Last Updated:</strong> July 04, 2025</p>

    <p>This website, <?= htmlspecialchars($domainName); ?>, and the <?= htmlspecialchars($brandName); ?> platform operate as a free marketing system intended for educational and promotional use by affiliate marketers and network marketers.</p>

    <h4>1. Independent Status</h4>
    <p>We are independent marketers and not affiliated, owned, or operated by any of the third-party income streams showcased within our platform. All brands, logos, and names remain the property of their respective owners.</p>

    <h4>2. No Financial Advice</h4>
    <p>Nothing on this site should be construed as financial, legal, or investment advice. You must conduct your own research and due diligence before making any financial decisions related to opportunities shown in the members area.</p>

    <h4>3. No Earnings Guarantees</h4>
    <p>We make no guarantees of income. All earnings shown or implied are the result of individual effort and not typical. Your success depends on your work ethic, skills, and ability to follow through.</p>

    <h4>4. Third-Party Risk</h4>
    <p>We do not manage or support payments, commissions, or policies related to third-party programs. Any concerns about payouts or operations should be directed to the respective program's official support.</p>

    <h4>5. Community Conduct</h4>
    <p>Statements or promotions made by members in our system, training calls, or support groups are their personal views and not endorsed by <?= htmlspecialchars($brandName); ?>. We are not responsible for any misinformation shared by users.</p>

    <h4>6. Use at Your Own Risk</h4>
    <p>You are responsible for how you use the tools, templates, and suggestions provided by this platform. While we strive to provide value, you use this system at your own discretion and risk.</p>

    <h4>7. Contact</h4>
    <p>If you have questions about this disclaimer or how this system works, please use the contact form available at <?= htmlspecialchars($domainName); ?>.</p>
</div>

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

</body>
</html>
