Can anyone please add pagination to the below autoindex?
PHP Code:
<?php
$size_bytes = 100072000;
$kb = $size_bytes / 1024;
$mb = $size_bytes / 1024000;
$section = $_GET['load'];
if(!($dp = opendir($section))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php")
{
$file_array[filemtime("$section/$file")] = $file;
}
}
$file_count = count ($file_array);
krsort($file_array);
if ($file_count > 0)
{
$first_record = $page * $items_per_page;
$last_record = $first_record + $items_per_page;
}
while (list($fileIndexValue, $file_name) = each ($file_array))
{
echo '<a href="'.$section.'/'.$file_name.'">'.$file_name.'</a>';
}
closedir($dp);
?>