Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

<?

php
session_start();
error_reporting( 0 );
include( 'includes/dbconnection.php' );
// Include the database connection file

// HTML code starts here


?>
<!DOCTYPE html>
<html class = 'no-js' lang = 'zxx'>

<head>
<title>Online Notes Sharing System | Notes</title>
<!-- CSS files -->
<!-- Include your CSS files here -->
<link rel = 'stylesheet' href = 'assets/css/bootstrap.min.css'>
<!-- Include other CSS files as needed -->
</head>

<body>
<?php include_once( 'includes/header.php' );
?>
<!-- Include header -->
<main>
<!-- Slider section -->
<section class = 'slider-area slider-area2'>
<!-- Slider content goes here -->
</section>

<!-- Notes section -->


<div class = 'courses-area section-padding40 fix'>
<div class = 'container'>
<div class = 'row justify-content-center'>
<div class = 'col-xl-7 col-lg-8'>
<div class = 'section-tittle text-center mb-55'>
<h2>Our featured Notes</h2>
</div>
</div>
</div>
<div class = 'row'>
<!-- Fetch notes from the database and display -->
<?php
// Check for current page number
$pageno = isset( $_GET[ 'pageno' ] ) ? $_GET[ 'pageno' ] : 1;
$no_of_records_per_page = 20;
// Number of records to display per page
$offset = ( $pageno - 1 ) * $no_of_records_per_page;
// Get total number of records
$total_pages_sql = 'SELECT COUNT(*) FROM videos';
$result = $dbh->prepare( $total_pages_sql );
$result->execute();
$total_rows = $result->fetchColumn();
$total_pages = ceil( $total_rows / $no_of_records_per_page );
// Fetch notes with pagination
$sql = "SELECT * FROM videos LIMIT $offset, $no_of_records_per_page";
$query = $dbh->prepare( $sql );
$query->execute();
$results = $query->fetchAll( PDO::FETCH_ASSOC );
// Loop through fetched notes and display them
foreach ( $results as $row ) {
?>
<!-- Display each note -->
<div class = 'col-lg-6'>
<div class = 'properties properties2 mb-30'>
<div class = 'properties__card'>
<div class = 'properties__img overlay1'>
<?php
// Check if video type is file or YouTube link and display appropriate
thumbnail
if ( $row[ 'VideoType' ] == 'file' ) {
echo '<a href="#"><img src="assets/img/featured2.png" width="300"
height="300" alt=""></a>';
} else {
echo '<a href="#"><img src="https://img.youtube.com/vi/' . $row[ 'VideoURL'
] . '/hqdefault.jpg" alt=""></a>';
}
?>
</div>
<div class = 'properties__caption'>
<!-- Display note details -->
<p><?php echo htmlentities( $row[ 'Subject' ] );
?></p>
<h3><?php echo htmlentities( $row[ 'NotesTitle' ] );
?> By ( <?php echo htmlentities( $row[ 'UserID' ] );
?> )</h3>
<p><?php echo htmlentities( $row[ 'NotesDecription' ] );
?>.</p>
<!-- Display download link for files or embedded player for YouTube links -->
<?php
if ( $row[ 'VideoType' ] == 'file' ) {
echo '<a href="' . $row[ 'VideoURL' ] . '" target="_blank" class="btn bnt-
primary">Download File</a>';
} else {
echo '<iframe width="100%" height="315" src="' . $row[ 'VideoURL' ] . '"
frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media;
gyroscope; picture-in-picture" allowfullscreen></iframe>';
}
?>
</div>
</div>
</div>
</div>
<?php }
?>
</div>
<!-- Pagination section -->
<div class = 'pagination justify-content-center'>
<ul class = 'pagination'>
<!-- Previous page link -->
<li class = "<?php if ($pageno <= 1) echo 'disabled'; ?>">
<a href = '?pageno=1'>&laquo;
</a>
</li>

<li class = "<?php if ($pageno <= 1) echo 'disabled'; ?>">


<a href = "<?php if ($pageno <= 1) echo '#';
else echo "?pageno = " . ($pageno - 1); ?>">&lsaquo;
</a>
</li>
<!-- Page numbers -->
<?php for ( $i = 1; $i <= $total_pages; $i++ ) : ?>
<li class = "<?php if ($pageno == $i) echo 'active'; ?>">
<a href = "?pageno=<?php echo $i; ?>"><?php echo $i;
?></a>
</li>
<?php endfor;
?>
<!-- Next page link -->
<li class = "<?php if ($pageno >= $total_pages) echo 'disabled'; ?>">
<a href = "<?php if ($pageno >= $total_pages) echo '#';
else echo "?pageno = " . ($pageno + 1); ?>">&rsaquo;
</a>
</li>
<li class = "<?php if ($pageno >= $total_pages) echo 'disabled'; ?>">
<a href = "?pageno=<?php echo $total_pages; ?>">&raquo;
</a>
</li>
</ul>
</div>
</div>
</div>
</main>

<!-- Include footer -->


<?php include_once( 'includes/footer.php' );
?>

<!-- Include JavaScript files -->


<!-- Include your JS files here -->

<script src = './assets/js/vendor/modernizr-3.5.0.min.js'></script>


<!-- Jquery, Popper, Bootstrap -->
<script src = './assets/js/vendor/jquery-1.12.4.min.js'></script>
<script src = './assets/js/popper.min.js'></script>
<script src = './assets/js/bootstrap.min.js'></script>
<!-- Jquery Mobile Menu -->
<script src = './assets/js/jquery.slicknav.min.js'></script>

<!-- Jquery Slick, Owl-Carousel Plugins -->


<script src = './assets/js/owl.carousel.min.js'></script>
<script src = './assets/js/slick.min.js'></script>
<!-- One Page, Animated-HeadLin -->
<script src = './assets/js/wow.min.js'></script>
<script src = './assets/js/animated.headline.js'></script>
<script src = './assets/js/jquery.magnific-popup.js'></script>

<!-- Date Picker -->


<script src = './assets/js/gijgo.min.js'></script>
<!-- Nice-select, sticky -->
<script src = './assets/js/jquery.nice-select.min.js'></script>
<script src = './assets/js/jquery.sticky.js'></script>
<!-- Progress -->
<script src = './assets/js/jquery.barfiller.js'></script>

<!-- counter, waypoint, Hover Direction -->


<script src = './assets/js/jquery.counterup.min.js'></script>
<script src = './assets/js/waypoints.min.js'></script>
<script src = './assets/js/jquery.countdown.min.js'></script>
<script src = './assets/js/hover-direction-snake.min.js'></script>

<!-- contact js -->


<script src = './assets/js/contact.js'></script>
<script src = './assets/js/jquery.form.js'></script>
<script src = './assets/js/jquery.validate.min.js'></script>
<script src = './assets/js/mail-script.js'></script>
<script src = './assets/js/jquery.ajaxchimp.min.js'></script>

<!-- Jquery Plugins, main Jquery -->


<script src = './assets/js/plugins.js'></script>
<script src = './assets/js/main.js'></script>
</body>

</html>

You might also like