D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
Filename :
youtube.php
back
Copy
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Videos </title> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta content="" name="keywords"> <meta content="" name="description"> <!-- Favicon --> <link href="img/favicon.ico" rel="icon"> <!-- Google Web Fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Barlow:wght@600;700&family=Ubuntu:wght@400;500&display=swap" rel="stylesheet"> <!-- Icon Font Stylesheet --> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet"> <!-- Libraries Stylesheet --> <link href="lib/animate/animate.min.css" rel="stylesheet"> <link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"> <link href="lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" /> <!-- Customized Bootstrap Stylesheet --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Template Stylesheet --> <link href="css/style.css" rel="stylesheet"> <style> .embed-responsive iframe { width: 100%; /* Adjust the width as needed */ height: 100%; /* Adjust the height as needed */ } </style> </head> <body> <!-- Spinner Start --> <!-- Spinner End --> <!-- Topbar Start --> <!-- Topbar End --> <!-- Navbar Start --> <?php include 'include/menu.php';?> <!-- Navbar End --> <!-- videos Start --> <div class="container"> <h1>Video Gallery</h1> <div class="row"> <div class="row"> <?php // Function to extract YouTube video ID from a URL function getYouTubeVideoID($url) { $videoID = ''; $pattern = '/[\\?\\&]v=([^\\?\\&]+)/'; preg_match($pattern, $url, $matches); if (isset($matches[1])) { $videoID = $matches[1]; } return $videoID; } include 'config.php'; // Pagination parameters $videosPerPage = 8; // Number of videos per page $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1; // Get the current page $offset = ($currentPage - 1) * $videosPerPage; // Fetch videos for the current page $sql = "SELECT * FROM videos ORDER BY id DESC LIMIT $videosPerPage OFFSET $offset"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo '<div class="col-md-3 mb-4">'; echo '<div class="card">'; echo '<div class="embed-responsive embed-responsive-16by9">'; echo '<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/' . getYouTubeVideoID($row['vedio_link']) . '" allowfullscreen></iframe>'; echo '</div>'; echo '<p class="card-text">' . $row['vedio_date'] . '</p>'; echo '<div class="card-body">'; echo '<h7 class="card-title"><a href="view_video.php?id=' . $row['id'] . '">' . $row['vedio_name'] . '</a></h7>'; // Make video name clickable echo '<p class="card-text">' . $row['description'] . '</p>'; echo '</div>'; echo '</div>'; echo '</div>'; } } else { echo "No videos found."; } // Close the database connection $conn->close(); ?> </div> <!-- Pagination --> <ul class="pagination justify-content-center"> <?php // Calculate the total number of pages $conn = new mysqli($servername, $username, $password, $dbname); $sql = "SELECT COUNT(id) AS total_videos FROM videos"; $result = $conn->query($sql); $row = $result->fetch_assoc(); $totalVideos = $row['total_videos']; $totalPages = ceil($totalVideos / $videosPerPage); // Previous page if ($currentPage > 1) { echo '<li class="page-item"><a class="page-link" href="?page=' . ($currentPage - 1) . '">Previous</a></li>'; } // Page numbers for ($i = 1; $i <= $totalPages; $i++) { echo '<li class="page-item' . ($i == $currentPage ? ' active' : '') . '"><a class="page-link" href="?page=' . $i . '">' . $i . '</a></li>'; } // Next page if ($currentPage < $totalPages) { echo '<li class="page-item"><a class="page-link" href="?page=' . ($currentPage + 1) . '">Next</a></li>'; } ?> </ul> <!-- End Pagination --> </div> </div> <!-- Footer Start --> <?php include 'include/footer.php';?> <!-- Footer End --> <!-- Back to Top --> <a href="#" class="btn btn-lg btn-primary btn-lg-square back-to-top"><i class="bi bi-arrow-up"></i></a> <!-- Add Bootstrap JS and jQuery --> <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <!-- JavaScript Libraries --> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script> <script src="lib/wow/wow.min.js"></script> <script src="lib/easing/easing.min.js"></script> <script src="lib/waypoints/waypoints.min.js"></script> <script src="lib/counterup/counterup.min.js"></script> <script src="lib/owlcarousel/owl.carousel.min.js"></script> <script src="lib/tempusdominus/js/moment.min.js"></script> <script src="lib/tempusdominus/js/moment-timezone.min.js"></script> <script src="lib/tempusdominus/js/tempusdominus-bootstrap-4.min.js"></script> <!-- Template Javascript --> <script src="js/main.js"></script> </body> </html>