<?
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();
aut();
if (isset($_GET['id']))$id=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$id' LIMIT 1"),0)==0){header("Location: index.php?id=".$user['id']."");
exit;}
if($id==$user['id']){
echo'<img src="img/folder_plus.png" alt=""/> <a href="/file/edit.php?id=0&amp;act=new">Создать папку</a>';
echo'<br/>---<br/>';}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user_dir` WHERE `id_user` = '$id' AND `dir` = '0'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0){echo "Папка пуста<br/>";}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$id' LIMIT 1"));
$q = mysql_query("SELECT * FROM `user_dir` WHERE `id_user` = '$id' AND `dir` = '0' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q)){
### Счётчик
$k_f=0;
$q3=mysql_query("SELECT * FROM `user_dir` WHERE `dir` = '$post[id]'");
while ($post2 = mysql_fetch_array($q3)){
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `user_files` WHERE `dir` = '$post2[id]'"),0);
}
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `user_files` WHERE `dir` = '$post[id]'"),0);
###
echo'<img src="img/folder_open.png" alt=""/> <a href="/file/dir.php?id='.$id.'&amp;dir='.$post['id'].'">'.htmlentities($post['name'], ENT_QUOTES, 'UTF-8').'</a> ('.$k_f.')';
if($id==$user['id']){
echo' [<a href="/file/edit.php?id='.$post['id'].'&amp;act=rename">Переим.</a>] | [<a href="/file/edit.php?id='.$post['id'].'&amp;act=delete">Удал.</a>]';}
echo'<br/>';
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
include_once '../sys/inc/tfoot.php';
?>