<?php
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();

only_reg();

$id = intval($_GET['id']);
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$id."'"));
$ank_num = mysql_num_rows(mysql_query("SELECT * FROM `user` WHERE `id` = '".$id."'"));

echo '<div class="mytitle">';
echo ''.online($ank['id']).' <a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>';
echo 'Файлы пользователя<br/>';
echo '</div>';

if ($ank_num == 0){

echo '<div class="komm">';
echo 'Пользователь не найден.<br/>';
echo '</div>';

}else{

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user_files_mod_papka` WHERE `kto_id` = '".$id."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$res = mysql_query("select * from `user_files_mod_papka` WHERE `kto_id` = '".$id."' order by time LIMIT $start, $set[p_str];");

if ($k_post==0){

echo '<div class="komm">';
echo 'Нет файлов.<br/>';
echo '</div>';

}else{

while ($post = mysql_fetch_array($res)){

$files = mysql_num_rows(mysql_query("SELECT * FROM `user_files_mod_files` WHERE `dir` = '".$post['id']."'"));
$files_t = mysql_num_rows(mysql_query("SELECT * FROM `user_files_mod_files` WHERE `dir` = '".$post['id']."' and `time` > '".(time()-86400)."'"));

echo '<div class="str">';
echo '<img src="/user/files/image/dir.png" alt="."/> <a href="/user/files/dir.php?id='.$post['id'].'">'.output_text($post['name']).'</a> '.$files.'';
if ($files_t>0){echo ' <font color="red">+'.$files_t.'</font>';}
echo '<br/>';
echo '<small>'.output_text(substr($post['opis'],0,70)).'...</small><br/>';
echo '</div>';

}

if ($k_page>1)str('?id='.$id.'&',$k_page,$page);

}

}
if (isset($user) && $user['id']==$ank['id'])
{
echo '<div class="royal">';
echo '<img src="/style/img/plus.gif" alt="."/> <a href="/user/files/new_papka.php">Создать папку</a><br/>';
echo '<img src="/style/img/plus.gif" alt="."/> <a href="/user/files/new_file.php">Добавить файл</a><br/>';
echo '</div>';
}
include_once '../../sys/inc/tfoot.php';
?>