<?php
session_start();

// Prevent caching so the back button doesn't show the page after logout
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

$dataFile = __DIR__ . '/data.json';
$data = [];
if (file_exists($dataFile)) {
    $content = file_get_contents($dataFile);
    $parsed = json_decode($content, true);
    if (is_array($parsed)) {
        $data = $parsed;
    }
}
$defaults = [
    'name' => 'MADISON LIPPY',
    'link' => 'https://a.vlmjm1.com/902d7ca3-4ca7-4bea-9d1a-db69f9494a3b?aff_id=289237&aff_sub5=SF_006OG00000Hahav&source=',
    'photos_count' => 917,
    'videos_count' => 367,
    'profile_image' => 'img/profile.jpeg',
    'gallery_images' => [
        'img/gallery1.jpeg',
        'img/gallery2.jpeg',
        'img/gallery3.jpeg',
        'img/gallery4.jpeg'
    ]
];
$data = array_replace_recursive($defaults, $data);
if (isset($parsed['gallery_images'])) {
    $data['gallery_images'] = $parsed['gallery_images'];
}
$link = htmlspecialchars($data['link'], ENT_QUOTES, 'UTF-8');
$name = htmlspecialchars($data['name'], ENT_QUOTES, 'UTF-8');
$photosCount = (int) $data['photos_count'];
$videosCount = (int) $data['videos_count'];
$profileImage = htmlspecialchars($data['profile_image'], ENT_QUOTES, 'UTF-8');
$galleryImages = array_map(function ($img) {
    return htmlspecialchars($img, ENT_QUOTES, 'UTF-8');
}, $data['gallery_images']);
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>Creator Profile</title>
    <link rel="icon" href="data:,">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">


    <link rel="preload" as="image" href="<?= $profileImage ?>" fetchpriority="high">
    <link rel="preload" as="font" type="font/woff2" href="fonts/JTUSjIg69CK48gW7PXoo9WlhyyTh89Y.woff2" crossorigin>
    <link rel="preload" as="font" type="font/woff2" href="fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7W0Q5nw.woff2" crossorigin>

    <style>
<?= file_get_contents(__DIR__ . '/fontfile.css') ?>
<?= file_get_contents(__DIR__ . '/bootstrap-manual.css') ?>
<?= file_get_contents(__DIR__ . '/style.css') ?>
        /* Prevent image saving & dragging */
        img {
            -webkit-user-drag: none;
            -khtml-user-drag: none;
            -moz-user-drag: none;
            -o-user-drag: none;
            user-drag: none;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            user-select: none;
            pointer-events: auto;
        } 
    </style>
</head>

<body>

    <div class="container-fluid py-5 px-5">

        <div class="row align-items-center">

            <!-- Left -->
            <div class="col-lg-8">

                <!-- Profile -->
                <div class="row align-items-center">

                    <div class="col-4 text-center">

                        <div class="profile-image">

                            <img src="<?= $profileImage ?>" class="img-fluid rounded-circle" fetchpriority="high">

                            <span class="online"></span>

                        </div>

                    </div>

                    <div class="col-8">

                        <h1 class="display-2 fw-bold creator-name">
                            <div class="provile_name"><?= $name ?></div>
                            <div class=""> <img src="img/assets/Country_icon.png"> <img src="img/assets/verify_icon.png"> </div>
                        </h1>

                        <p class=" pro_sub">
                            Your favorite creator for exclusive content, live shows & more
                        </p>

                        <div class="row mt-4">
                            <div class="col-6">
                                <div class="set_icons border-r">
                                    <div class="icons_pro">
                                        <img src="img/assets/video_icon.png">
                                    </div>
                                    <div class="text_pro">
                                        <h3><?= $videosCount ?></h3>
                                        <p>VIDEOS</p>
                                    </div>
                                </div>
                            </div>

                            <div class="col-6">
                                <div class="set_icons">
                                    <div class="icons_pro">
                                        <img src="img/assets/gallary_icon.png">
                                    </div>
                                    <div class="text_pro">
                                        <h3><?= $photosCount ?></h3>
                                        <p>PHOTOS</p>
                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>


                </div>


            </div>

            <!-- right -->
            <div class="col-lg-4 ">
                <div class="side-card set-tpos">
                    <a href="#" data-bs-toggle="modal" data-bs-target="#affiliateModal" class="stretched-link">
                    </a>
                    <div class="side_main">
                        <div class="side_icon">
                            <img src="img/assets/fire_icon.png">
                        </div>
                        <div class="side_text">
                            <h3> WATCH ME NOW</h3>
                            <p class="mob_noie">Join my live show</p>
                        </div>
                    </div>
                    <div class="side_arrow">
                        <img src="img/assets/right_arrow.png">
                    </div>
                </div>

                <div class="side-card mt-4">
                    <div class="side_main">
                        <a href="#" data-bs-toggle="modal" data-bs-target="#affiliateModal" class="stretched-link">
                        </a>
                        <div class="side_icon">
                            <img src="img/assets/ex_icon.png">
                        </div>
                        <div class="side_text">
                            <h3>EXCLUSIVE CONTENT</h3>
                            <p>View premium content</p>
                        </div>
                    </div>
                    <div class="side_arrow">
                        <img src="img/assets/right_arrow.png">
                    </div>
                </div>

            </div>
        </div>


        <div class="row mt-5">
            <div class="col-lg-8">
                <div class="card-dark gallery_div">

                    <div class="d-flex justify-content-between align-items-center mb-3">

                        <h4><label></label> <?= $photosCount ?> PHOTOS <i class="bi bi-dot"></i> <span>UPDATED TODAY</span></h4>

                        <a href="#" data-bs-toggle="modal" data-bs-target="#affiliateModal" class="text-pink text-decoration-none">
                            VIEW ALL CONTENT <i class="bi bi-chevron-right"></i>
                        </a>

                    </div>

                    <div class="gap-3 d-flex">

                        <?php 
                        $displayImages = array_slice($galleryImages, 0, 4);
                        foreach ($displayImages as $key => $galleryImage): 
                        ?>
                            <div class="col-web">
                                <a href="#" data-bs-toggle="modal" data-bs-target="#affiliateModal">
                                    <div class="gallery-img">
                                        <img src="<?= $galleryImage ?>" class="gallery">
                                        <?php if (isset($displayImages[$key + 1])) { ?>
                                            <div class="gray_scale remove_tavv">
                                            </div>
                                        <?php } else { ?>
                                            <div class="gray_scale">
                                                <img src="img/assets/Private.png">
                                            </div>
                                        <?php } ?>
                                    </div>
                                </a>
                            </div>
                        <?php endforeach ?>

                    </div>

                </div>
            </div>
        </div>
        <!-- Gallery -->

        <!-- Bottom Cards -->



        <!-- Right -->






    </div>

    </div>

    <footer class=" border-top-color mt-5 py-4">

        <div class="container-fluid px-5">

            <div class="footer_maind">

                <div class="footer-left">
                    <div class="footer_ter">
                        <div class="footer-logoimg me-4"><img src="img/assets/logo.png"></div>

                        <a href="<?= $link ?>" class="text-secondary me-4">Privacy Policy</a>
                        <a href="<?= $link ?>" class="text-secondary me-4">Terms of Service</a>
                        <a href="mailto:dmca.team@proton.me" class="text-secondary me-4">DMCA</a>
                        <a href="<?= $link ?>" class="text-secondary"> 18 U.S.C. 2257</a>

                    </div>

                </div>

                <div class="footer-right text-md-end text-secondary">

                    © 2026 <?= $name ?>. All rights reserved

                </div>

            </div>

        </div>

    </footer>

    </div>


    <!-- Affiliate Modal -->
    <div class="modal fade" id="affiliateModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered mx-auto" style="max-width: 360px;">
            <div class="modal-content text-center" style="background-color: var(--panel, #161a22); border: 1px solid var(--border, #2a2f3d); color: var(--text, #e8eaf0); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.8);">
                <div class="modal-header border-0 pb-0 position-relative">
                    <button type="button" class="border-0 position-absolute top-0 end-0 m-2 d-flex align-items-center justify-content-center" data-bs-dismiss="modal" aria-label="Close" style="background-color: var(--text, #e8eaf0); color: var(--panel, #161a22); border-radius: 50%; width: 28px; height: 28px; z-index: 9999; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: all 0.2s ease;">
                        <span aria-hidden="true" style="font-size: 1.2rem; font-weight: bold; line-height: 1; margin-top: -2px;">&times;</span>
                    </button>
                </div>
                <div class="modal-body pt-0 px-4 pb-4">
                    <h2 class="fw-bold mb-3" style="color: var(--accent, #ff4d6d); font-family: 'Times New Roman', serif; font-size: 1.6rem; letter-spacing: 1px;"><?= mb_strtoupper($name, 'UTF-8') ?></h2>
                    
                    <p class="fw-bold small mb-2">Watch explicit content for FREE in "Jerkmate"</p>
                    <div class="small mb-3" style="line-height: 1.6; color: #8a90a3;">
                        1- Create a FREE Jerkmate Account<br>
                        2- Get the Free Lifetime Membership<br>
                        3- Enjoy thousands of models like me
                    </div>

                    <a href="<?= $link ?>" class="d-block position-relative mb-3 text-decoration-none" style="border-radius: 8px; overflow: hidden; background-color: #2a2f3d;">
                        <img src="popup.gif" alt="Exclusive Offer" style="width: 100%; height: auto; display: block;">
                    </a>

                    <a href="<?= $link ?>" class="btn rounded-pill w-100 fw-bold fs-5" style="background-color: #000; border: 1px solid #333; color: #ff4d6d; padding: 10px;">
                        Join for Free
                    </a>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Disable right-click on the entire page to prevent saving elements
        document.addEventListener('contextmenu', function(e) {
             e.preventDefault();
         });
    </script>
</body>

</html>
