View file Upload/Upload/files.php

File size: 0.98Kb
<?php
require('includes/header.php');
require('includes/utils.php');



$max_files = 10;


   $from = 0;

$to = $from + $max_files;

$n = 0;
$files = '';
$total_size = 0;
if ($handle = opendir("files/$login"))
{
   while (false !== ($file = readdir($handle)))
   {
      if($file != '.' && $file != '..')
      {
         $filesize = filesize("files/$login/$file");
         $total_size += $filesize;
         if($n >= $from && $n < $to)
         $files .= <<<FILEDATA
<a href="files/$login/$file">$file</a> ($filesize байт)
<br/>
FILEDATA;
         $n++;
      }
   }
   closedir($handle);
}

if($n > $to )
         $files .= <<<FILEDATA
<a href="files.php?login=$login&amp;from=$to">Далее</a>
<br/>
FILEDATA;

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



echo '<wml>
<card id=\'main\' title=\'Файлы\'>
<p align=\'center\'>';

echo $files;

echo '</p>
</card>
</wml>';


?>