Please add pagination

Started on the old forum in November 2012 · view the original in the archive · old links redirect here

No replies · 459 views · started 14 years ago · 1 min read

febin7210 Newbie · 1 posts #1

Can anyone please add pagination to the below autoindex?

<?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);
?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close