tytdarchive/www/videos.php

71 lines
2.0 KiB
PHP
Raw Permalink Normal View History

2024-08-28 02:51:48 +00:00
<?php
include("header-1.php");
?>
<title>TYTD Archive - All Videos</title>
<?php
include("header-2.php");
?>
<div class="alert alert-info" role="alert">
The videos page may be empty, click next till videos start showing up.
</div>
<?php
$offset = 0;
$page_first=0;
include_once 'db.php';
if(isset($_GET["page"]))
{
$offset = ((int)$_GET["page"])-1;
$page_first = $offset - ($offset % 3);
}
$stmt = $pdo->prepare("select * from SavedVideo LIMIT ".strval($offset*20).", 20");
$stmt->execute();
$videos = $stmt->fetchAll();
foreach($videos as $video)
{
$class = "class=\"bg-danger\"";
if(strlen(video_exists($video["Id"],"PreMuxed")) > 0)
{
echo "<a href=\"./watch.php?v=".$video["Id"]."\">".htmlspecialchars($video["Title"])."</a>";
echo "<br>";
}
}
?>
<nav aria-label="...">
<ul class="pagination">
<li class="page-item <?php if($offset == 0) echo "disabled"; ?>">
<a class="page-link" href="./videos.php?page=<?php echo $offset; ?>">Previous</a>
</li>
<li class="page-item <?php
if(($page_first) == $offset) echo "active";
?>"><a class="page-link" href="./videos.php?page=<?php echo $page_first+1; ?>"><?php
echo $page_first+1;
?></a></li>
<li class="page-item <?php
if(($page_first+1) == $offset) echo "active";
?>">
<a class="page-link" href="./videos.php?page=<?php echo $page_first+2; ?>"> <span class="sr-only"><?php
echo $page_first+2;
?></span></a>
</li>
<li class="page-item <?php
if(($page_first+2) == $offset) echo "active";
?>"><a class="page-link" href="./videos.php?page=<?php echo $page_first+3; ?>"><?php
echo $page_first+3;
?></a></li>
<li class="page-item">
<a class="page-link" href="./videos.php?page=<?php echo $offset+2; ?>">Next</a>
</li>
</ul>
</nav>
<?php
include("footer.php");
?>