ok

Mini Shell

Direktori : /home/importfo/public_html/importfolio.in/
Upload File :
Current File : /home/importfo/public_html/importfolio.in/reels.php

<?php
// Start the session
session_start();
$timeout_duration = 600;

// Check if the user is logged in
if (!isset($_SESSION['user_id'])) {
    // If not logged in, redirect to the login page
    header('Location: index.php');
    exit;
}

// Check for session timeout
if (isset($_SESSION['loggedin_time']) && (time() - $_SESSION['loggedin_time']) > $timeout_duration) {
    // Unset and destroy the session
    session_unset();
    session_destroy();
    
    // Redirect to login page with a message
    header('Location: index.php?timeout=true');
    exit;
} else {
    // Update the logged-in time if session is active
    $_SESSION['loggedin_time'] = time();
}
?>

<?php include ("admin/config.php");?>
<!DOCTYPE html>
<html lang="en">

<head>
    <?php include('top.php');?>

    <!-- Pagination CSS -->
    <style>
        /* Pagination Container */
        .pagination-container {
            text-align: center;
            margin-top: 30px;
        }

        /* Pagination Links */
        .pagination {
            display: inline-block;
            padding: 0;
            margin: 0;
        }

        /* Each Page Link */
        .pagination a {
            color: #333;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
            transition: background-color 0.3s;
            border: 1px solid #ddd;
            margin: 0 4px;
            border-radius: 4px;
        }

        /* Active Page Styling */
        .pagination a.active {
            background-color: #007bff;
            color: white;
            border: 1px solid #007bff;
        }

        /* Hover Effects */
        .pagination a:hover {
            background-color: #ddd;
            border: 1px solid #ccc;
        }

        /* Left/Right Arrow */
        .pagination a.arrow {
            font-size: 18px;
            padding: 6px 12px;
        }

        .video-thumbnail {
            position: relative;
            cursor: pointer;
            display: inline-block;
            margin-bottom: 20px;
        }

        .video-thumbnail img {
            width: 100%;
            height: auto;
        }

        .video-thumbnail:before {
            content: '\f04b';
            font-family: FontAwesome;
            font-size: 50px;
            color: rgba(255, 255, 255, 0.8);
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .portfolio-detail-img-box-one {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-around;
        }

        .portfolio-detail-img-one {
            flex-basis: 22%;
            margin-bottom: 30px;
        }
    </style>
</head>

<body>
    <!-- Header Start -->
    <?php include('header.php');?>
    <!-- Header End -->

    <!--Banner Start-->
    <section class="main-inner-banner-one">
        <div class="blur-1">
            <img src="assets/images/Blur_1.png" alt="bg blur">
        </div>
        <div class="blur-2">
            <img src="assets/images/Blur_2.png" alt="bg blur">
        </div>
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="breadcrum-title-one">
                        <h1 class="h1-title">Reels</h1>
                        <div class="breadcrum-one">
                            <ul>
                                <li><a href="index.php">Home</a></li>
                                <li><i class="fa fa-chevron-right"></i></li>
                                <li><a href="#">Reels</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!--Banner End-->

    <!--Portfolio Detail Start-->
    <section class="main-portfolio-detail-one">
        <div class="container">
            <div class="portfolio-detail-img-box-one">
                <div class="row">
                    <?php
                    // Number of videos per page
                    $videosPerPage = 20;
                    $page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
                    $start = ($page - 1) * $videosPerPage;

                    // Fetch videos from database
                    $sql = "SELECT * from reels ORDER BY id DESC LIMIT $start, $videosPerPage";
                    $res = mysqli_query($db, $sql);
                    while ($row = mysqli_fetch_array($res)) {
                    ?>
                        <div class="col-lg-3 col-md-6">
                            <div class="portfolio-detail-img-one wow fadeInUp" data-wow-delay=".4s">
                                <!-- Video Thumbnail -->
                                <div class="video-thumbnail" onclick="loadVideo(this, '<?php echo $row['videolink']; ?>')">
                                    <img src="https://img.youtube.com/vi/<?php echo $row['videolink']; ?>/0.jpg" alt="Video Thumbnail">
                                </div>
                            </div>
                        </div>
                    <?php } ?>
                </div>
            </div>

            <!-- Pagination -->
            <div class="pagination-container">
                <div class="pagination">
                    <?php
                    $totalVideosQuery = "SELECT COUNT(*) AS total FROM reels";
                    $totalResult = mysqli_fetch_assoc(mysqli_query($db, $totalVideosQuery));
                    $totalVideos = $totalResult['total'];
                    $totalPages = ceil($totalVideos / $videosPerPage);

                    // Previous Button
                    if ($page > 1) {
                        $prevPage = $page - 1;
                        echo "<a href='?page=$prevPage' class='arrow'>&laquo;</a>";
                    }

                    // Page Numbers
                    for ($i = 1; $i <= $totalPages; $i++) {
                        if ($i == $page) {
                            echo "<a href='?page=$i' class='active'>$i</a>";
                        } else {
                            echo "<a href='?page=$i'>$i</a>";
                        }
                    }

                    // Next Button
                    if ($page < $totalPages) {
                        $nextPage = $page + 1;
                        echo "<a href='?page=$nextPage' class='arrow'>&raquo;</a>";
                    }
                    ?>
                </div>
            </div>
        </div>
    </section>
    <!--Portfolio Detail End-->

    <!--Footer Start-->
    <?php include('footer.php');?>
    <!--Footer End-->

    <!--Back To Top Start-->
    <div class="progress-wrap active-progress">
        <svg class="progress-circle svg-content" width="100%" height="100%" viewBox="-1 -1 102 102">
            <path d="M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98"></path>
        </svg>
    </div>
    <!--Back To Top End-->

    <!-- Video Load Script -->
    <script>
        function loadVideo(container, videoId) {
            container.innerHTML = '<iframe width="250" height="300" src="https://www.youtube.com/embed/' + videoId + '?autoplay=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
        }
    </script>

    <!-- Jquery JS Link -->
    <script src="assets/js/jquery.min.js"></script>

    <!-- Bootstrap JS Link -->
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/popper.min.js"></script>

    <!-- Custom JS Link -->
    <script src="assets/js/custom.js"></script>

    <!-- Slick Slider JS Link -->
    <script src="assets/js/slick.min.js"></script>

    <!-- Wow Animation JS -->
    <script src="assets/js/wow.min.js"></script>

    <!-- Bg Moving Js -->
    <script src="assets/js/bg-moving.js"></script>

    <!--Back To Top JS-->
    <script src="assets/js/back-to-top.js"></script>
</body>

</html>

Zerion Mini Shell 1.0