Файл: content.php
Строк: 29
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');
$max_files = 5;
if(isset($_GET['from']))
$from = $_GET['from'];
else
$from = 0;
$to = $from + $max_files;
$login = $_GET['p'];
$n = 0;
$files = '';
$total_size = 0;
if ($handle = opendir("$login/files/"))
{
while (false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..')
{
$filesize = filesize("$login/files/$file");
$total_size += $filesize;
if($n >= $from && $n < $to)
$files .= <<<FILEDATA
<a href="$login/files/$file">$file</a> ($filesize байт)
<br/>
FILEDATA;
$n++;
}
}
closedir($handle);
}
if($n > $to )
$files .= <<<FILEDATA
<a href="content.php?id=$id&p=$login&from=$to">Далее</a>
<br/>
FILEDATA;
$back_from = $from - $max_files;
if($from > 0)
$files .= <<<FILEDATA
<a href="content.php?id=$id&p=$login&from=$back_from">Назад</a>
<br/>
FILEDATA;
?>
<wml>
<card id="main" title="Меню">
<p align="center">
<?php echo $files; ?>
*********<br/>
<a href="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>">Меню</a><br/>
</p>
</card>
</wml>