Просмотр файла wapbuilder/content.php

Размер файла: 1.28Kb
<?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&amp;p=$login&amp;from=$to">Далее</a>
<br/>
FILEDATA;

$back_from = $from - $max_files;
if($from > 0)
   $files .= <<<FILEDATA
<a href="content.php?id=$id&amp;p=$login&amp;from=$back_from">Назад</a>
<br/>
FILEDATA;

?>
<wml>
<card id="main" title="&#x041C;&#x0435;&#x043D;&#x044E;">
<p align="center">
<?php echo $files; ?>
*********<br/>
<a href="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>">Меню</a><br/>
</p>
</card>
</wml>