Файл: obmen.php
Строк: 43
<?php
require('sistema/header.php');
require('sistema/utilition.php');
require('sistema/databaza.php');
require('sistema/config.php');
$max_files = 2;
if(isset($_GET['from']))
$from = $_GET['from'];
else
$from = 0;
$to = $from + $max_files;
$login = $_GET['login'];
$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="files?login=$login&from=$to">Далее</a>
<br/>
FILEDATA;
$back_from = $from - $max_files;
if($from > 0)
$files .= <<<FILEDATA
<a href="files.php?login=$login&from=$back_from">Назад</a>
<br/>
FILEDATA;
$banners = mysql_query('SELECT banner FROM users WHERE login = "' . mysql_real_escape_string($login) . '"');
list($banner) = mysql_fetch_array($banners);
?>
<wml>
<card id="main" title="Файлы">
<p align="center">
<?php
if($banner == 'top')
echo get_random_link();
?>
<?php echo $files; ?>
<?php
if($banner == 'bottom')
echo get_random_link();
?>
</p>
</card>
</wml>