<?
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();
aut(); // форма авторизации

if (isset($_GET['id'])) $id = intval($_GET['id']);
else {
echo '<div class="main_menu">Не выбран пользователь</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'];

if ($k_new==0)
{
echo 'У пользователя нет файлов';
}

$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'];


echo '<div class="main_menu">';

include 'inc/icon14.php';

$dir = mysql_fetch_array(mysql_query("SELECT * FROM `obmennik_dir` WHERE `id` = '$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";


include 'inc/opis.php';

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


if ($k_page>1)str('?',$k_page,$page); // Вывод страниц



include_once '../sys/inc/tfoot.php';
?>