I have php code for list all ".swf" files in a folder. (The name of the files is always: "99-dd-mm-YY_HH-mm-ss.swf", example: "01-19-06-2011_18-40-00.swf". When I have more than 500 files in the folder is complicated to see and to refresh the page.
I need paginate the list of files.
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title></title>
<script type="text/javascript">
function submitform()
{
document.myform.submit();
}
</script>
</head>
<body>
<form name="myform" action="some.php" method="post">
<?php
echo "
<br>
";
echo "<a href='javascript:this.location.reload();' style='color: #000000; font-weight: normal'>Refresh</a></br>";
echo "<tr>
<td>
<a href='javascript:javascript:history.go(-1)'>
";
echo "<img src='../../inc/img/back.png' alt='Back'";
echo " border=0>
";
echo "<b> Back</b></a></td>
";
echo "
</tr>
";
echo "
<br>
<br>
";
$folder='.';
function order($a,$b){
global $folder;
$directory='.';
return strcmp(strtolower($a), strtolower($b));
}
$folder=opendir($folder);
while($files=readdir($folder)){
$ext = pathinfo($files, PATHINFO_EXTENSION);
if ($ext == 'swf') { //con esta línea saco el nombre index.php del listado
$file[]=$files;
usort($file, "order");
}
}
$n = 0;
foreach($file as $archiv){
$n = $n + 1;
$day = substr($archiv, 3,10);
$day = str_replace("-","/", $day);
$hour = substr($archiv, 14,8);
$hour = str_replace("-",":", $hour);
echo "<img alt='Ver $archiv' src='../../inc/img/video.png'> Video $n, Día: $day, hour: $hour
";
echo "<input type='submit' name='xxx' value='$archiv'></td>
";
echo "
</tr>
";
echo "<br>";
}
closedir($folder);
echo "
<br>
";
echo "<tr>
<td>
<a href='javascript:javascript:history.go(-1)'>
";
echo "<img src='../../inc/img/back.png' alt='Back'";
echo " border=0>
";
echo "<b> Back</b></a></td>
";
echo "
</tr>
";
?>
</form>
</body>
</html>