<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';

$set['title']='Файлы пользователя';
include_once '../sys/inc/thead.php';
title();
err();


if (isset($_GET['id'])) $id=intval($_GET['id']);
else{
echo '<div class="err">Не выбран пользователь</div>';
include_once '../sys/inc/tfoot.php';
}

$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$id' LIMIT 1"));

$k_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_user` = '$ank[id]'"), 0);

$k_page = k_page($k_new,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
?>
<div class='fyt'>
<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &raquo <a href='/info.php?id=<?echo $ank['id'];?>'><?echo $ank['nick'];?></a> &raquo Файлы
</div>
<?
if ($k_new==0)
{
?>
<div class='noy'>У пользователя нет файлов</div>
<?
}

$q = mysql_query("SELECT * FROM `obmennik_files` WHERE `id_user` = '$ank[id]' ORDER BY time DESC LIMIT $start, $set[p_str]");

while ($post = mysql_fetch_array($q))
{
$ras=$post['ras'];
$file=H."sys/obmen/files/$post[id].dat";
$name=$post['name'];
$size=$post['size'];
if($num==1){
echo "<div class='enk_div'>\n";
$num=0;
}else{
echo "<div class='enk2_div'>\n";
$num=1;}

include 'inc/icon48.php';

$dir = mysql_fetch_array(mysql_query("SELECT * FROM `obmennik_dir` WHERE `id` = '".htmlspecialchars($post[id_dir])."' LIMIT 1"));

if ($set['echo_rassh']==1)$ras=".$post[ras]";else $ras=NULL;

echo "<a href='/obmen$dir[dir]$post[name].$post[ras]?showinfo'>$post[name]$ras</a><br />\n";

echo ' Папка: <a href="/obmen'.$dir['dir'].'?">'.$dir['name'].'</a>';
echo "</div>\n";
}

if ($k_page>1)str('?id='.$ank['id'].'&amp;',$k_page,$page); // Вывод страниц
?>
<div class='fyt'>
<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &raquo <a href='/info.php?id=<?echo $ank['id'];?>'><?echo $ank['nick'];?></a> &raquo Файлы
</div>
<?
include_once '../sys/inc/tfoot.php';
?>