<?php
declare(strict_types=1);

ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

ini_set('log_errors', '1');
ini_set('error_log', __DIR__ . '/php-error.log');

session_start();
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

function redirect(string $url): void {
    if (!headers_sent()) {
        header('Location: ' . $url);
    }
    exit;
}

function normalizeHost(string $host): string {
    $host = strtolower(trim($host));
    $host = preg_replace('/:\d+$/', '', $host);
    return $host;
}

try {
    $configCandidates = [
        __DIR__ . '/../../config/config5.php',
        '/home/fvme60ccdm8r/config/config5.php'
    ];

    $configPath = null;
    foreach ($configCandidates as $p) {
        if (is_readable($p)) {
            $configPath = $p;
            break;
        }
    }
    if (!$configPath) {
        throw new Exception('Config file missing or not readable. Tried: ' . implode(' | ', $configCandidates));
    }
    require_once $configPath;

    $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

    $is_admin = !empty($_SESSION['admin_logged_in']);

    if (isset($_GET['logout'])) {
        session_destroy();
        redirect('/portfolio/index.php?page=1');
    }

    $host = normalizeHost($_SERVER['HTTP_HOST'] ?? 'vsatdomains.com');
    $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';

    // FIXED: canonical should reflect the real URL under /portfolio
    $canonical = $scheme . '://' . $host . '/portfolio/about.php';

} catch (Throwable $e) {
    http_response_code(500);
    echo "<pre style='white-space:pre-wrap;color:red;'>";
    echo "FATAL ERROR: " . htmlspecialchars($e->getMessage()) . "\n";
    echo "File: " . htmlspecialchars($e->getFile()) . "\n";
    echo "Line: " . (int)$e->getLine() . "\n";
    echo "</pre>";
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>About VSATDomains | Premium Domain Marketplace</title>

    <meta name="description" content="Learn about VSATDomains, a premium domain marketplace for buying, renting, and leasing brandable domains. Part of the Metaverde, LLC seller network including RealTLD, FlatFeeNames, DomainFoxx, and more.">
    <meta name="keywords" content="VSATDomains, premium domains, domain marketplace, buy domains, rent domains, lease domains, brandable domains, Metaverde, RealTLD, FlatFeeNames, DomainFoxx, DomainSala">
    <meta name="author" content="Metaverde, LLC">
    <meta name="robots" content="index,follow">
    <meta name="theme-color" content="#000000">

    <link rel="canonical" href="<?php echo htmlspecialchars($canonical); ?>">

    <meta property="og:type" content="website">
    <meta property="og:title" content="About VSATDomains | Premium Domain Marketplace">
    <meta property="og:description" content="VSATDomains connects buyers to premium, brandable domains with options to buy, rent, or lease. Backed by Metaverde, LLC and a trusted seller network.">
    <meta property="og:url" content="<?php echo htmlspecialchars($canonical); ?>">
    <meta property="og:site_name" content="VSATDomains">
    <meta property="og:image" content="<?php echo htmlspecialchars($scheme . '://' . $host); ?>/og-image.jpg">

    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="About VSATDomains | Premium Domain Marketplace">
    <meta name="twitter:description" content="Buy, rent, or lease premium domains through VSATDomains. Secure transactions, competitive pricing, trusted sellers.">
    <meta name="twitter:image" content="<?php echo htmlspecialchars($scheme . '://' . $host); ?>/og-image.jpg">

    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "name": "VSATDomains",
      "url": "<?php echo htmlspecialchars($scheme . '://' . $host); ?>/portfolio/",
      "description": "Premium domain marketplace for buying, renting, and leasing brandable domains.",
      "publisher": {
        "@type": "Organization",
        "name": "Metaverde, LLC",
        "url": "https://metaverde.com/"
      },
      "potentialAction": {
        "@type": "SearchAction",
        "target": "<?php echo htmlspecialchars($scheme . '://' . $host); ?>/portfolio/index.php?search={search_term_string}",
        "query-input": "required name=search_term_string"
      }
    }
    </script>

    <link rel="stylesheet" href="styles.css">

    <style>
        body{
            margin:0;
            font-family: Arial, sans-serif;
            background:#f3f3f3;
            color:#111;
        }

        header{
            background:#000;
            color:#fff;
            padding:20px;
            text-align:center;
        }

        header h1{ margin:0; letter-spacing:0.5px; }
        header p{ margin:6px 0 0; opacity:0.9; }

        nav{
            margin:15px 0 0;
            position:relative;
        }

        .hamburger{
            display:none;
            font-size:24px;
            background:none;
            border:none;
            cursor:pointer;
            color:#fff;
            position:absolute;
            left:10px;
            top:50%;
            transform:translateY(-50%);
            z-index:1000;
        }

        nav ul{
            display:flex;
            justify-content:center;
            flex-wrap:wrap;
            margin:0;
            padding:0;
            list-style:none;
            z-index:999;
            gap:6px;
        }

        nav li{ margin:0; padding:0; }

        nav a{
            color:#fff;
            text-decoration:none;
            margin:0 10px;
            padding:10px 12px;
            display:block;
            border-radius:6px;
        }

        nav a:hover{
            background:rgba(255,255,255,0.08);
        }

        nav a.disabled{
            opacity:0.65;
            pointer-events:none;
        }

        .main{
            max-width:1100px;
            margin:20px auto;
            padding:0 18px;
        }

        .intro{
            background:#fff;
            border:1px solid #e6e6e6;
            border-radius:10px;
            padding:22px;
        }

        .intro h2{
            margin-top:0;
            color:#000;
        }

        .intro a{
            color:#000;
            font-weight:700;
            text-decoration:underline;
        }

        footer{
            background:#000;
            color:#fff;
            padding:25px 18px;
            margin-top:30px;
            text-align:center;
        }

        footer a{
            color:#fff;
            text-decoration:underline;
        }

        footer .contact h3{
            margin:0 0 8px;
        }

        @media (max-width:768px){
            .hamburger{ display:block; }
            nav ul{
                display:none;
                flex-direction:column;
                position:absolute;
                top:55px;
                left:50%;
                transform:translateX(-50%);
                width:84%;
                max-width:320px;
                background:#000;
                opacity:1;
                box-shadow:0 10px 25px rgba(0,0,0,0.25);
                padding:10px 0;
                border-radius:10px;
            }
            nav ul.active{ display:flex; }
            nav a{ margin:6px 12px; }
        }
    </style>
</head>
<body>
    <header>
        <h1>VSATDomains</h1>
        <p>Your Domain Marketplace - Buy, Rent, Lease</p>

        <nav>
            <button class="hamburger" onclick="toggleMenu()">☰</button>
            <ul>
                <li><a href="/portfolio/index.php?page=1">Home</a></li>
                <li><a href="/portfolio/about.php">About</a></li>
                <li><a href="/portfolio/contact.php">Contact</a></li>
                <?php if ($is_admin): ?>
                    <li><a href="/portfolio/index.php?logout=1" style="color:#ff9999;">Logout</a></li>
                <?php else: ?>
                    <li><a href="/portfolio/login.php">Admin Login</a></li>
                <?php endif; ?>
            </ul>
        </nav>
    </header>

    <div class="main">
        <div class="intro">
            <h2>About VSATDomains</h2>
            <p>VSATDomains is a premium domain marketplace where you can buy, rent, or lease high quality, brandable domain names for startups, agencies, ecommerce stores, and personal brands.</p>
            <p>We operate a trusted seller network under Metaverde, LLC, including RealTLD, FlatFeeNames, DomainFoxx, and DomainSala. Each marketplace offers its own curated inventory and pricing.</p>
            <p>Our mission is to make domain acquisition simple and secure with competitive pricing and safe transactions through Escrow.com. Whether you want to acquire a domain outright or explore flexible leasing options, VSATDomains helps you find the right name for your next move.</p>
            <p>For inquiries or support, contact us at <a href="mailto:info@metaverde.com">info@metaverde.com</a>.</p>
        </div>
    </div>

    <footer>
        <div class="contact">
            <h3>Contact Us</h3>
            <p>
                <a href="mailto:info@metaverde.com">Email</a> |
                <a href="https://twitter.com/VSATDomains">Twitter</a> |
                <a href="https://linkedin.com/company/VSATDomains">LinkedIn</a>
            </p>
        </div>
        <p>Our Sites: <a href="http://realtld.com">RealTLD</a> | <a href="http://bigshotdomains.com">BigShotDomains</a> |
        <a href="http://flatfeenames.com">FlatFeeNames</a> | <a href="http://domainfoxx.com">DomainFoxx</a> |
        <a href="http://viamet.com">ViaMet</a></p>
        <p><a href="http://developuniversity.com">Website by Develop University</a></p>
        <p>© 2025 VSATDomains</p>
    </footer>

    <script>
        function toggleMenu() {
            const navLinks = document.querySelector('nav ul');
            navLinks.classList.toggle('active');
        }
    </script>
</body>
</html>
<?php
// close db connection
if (isset($conn) && $conn instanceof mysqli) {
    $conn->close();
}
?>
