Somewhat based on a source I found online, but I want it to sort videos by creation/modification date. I've tried a number of solutions, but can't seem to find or come up with one that I am really satisfied with. I'd greatly appreciate if someone could point me in the right direction.
<?php
$dir = isset($_GET['cat']) ? $_GET['cat'] : 'straight';
$limit = 30;
$page = (int)$_GET['page']?:0;
$skip = $limit * $page;
if ($handle = opendir($dir)) {
$blacklist = array('.htaccess', '..', 'index.html');
$skiped = 0;
while (false !== ($file = readdir($handle))) {
if (!in_array($file, $blacklist)) {
$skipped++;
if ($skipped < $skip || $skipped >= $skip + $limit) {
continue;
}
echo "<div class=\"video-title\">
<a href=\"\">". $file ."</a>
</div>
<div style='display: block'>
<video loop controls
preload=\"auto\"
width=\"800px\"
id=\"video\"
class=\"b-lazy vjs-big-play-centered vjs-sublime-skin video-js\"
data-setup=\"{}\" >
<source src=\"". $dir . "/" . $file ."\" type=\"video/webm\">
<p class=\"vjs-no-js\">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href=\"http://videojs.com/html5-video-support/\" target=\"_blank\">supports HTML5 webm video</a>
</p>
</video>
</div>
<div class=\"video-footer\">
<a class=\"float-left\" href=\"". $dir . "/" . $file ."\">Download</a>
<a class=\"float-left\" href=\"". $dir . "/" . $file ."\">Share</a>
<a class=\"float-right\" href=\"contact.php?title=report&file=" . $file ."\">Report</a>
<a class=\"float-right\" href=\"Thread-" . $file ."\>Comment</a>
</div>
<br/>";
}
}
}
?>