Файл: user/files/index.php
Строк: 46
<?php
require_once '../../sys/inc/start.php';
require_once '../../sys/inc/compress.php';
require_once '../../sys/inc/sess.php';
require_once '../../sys/inc/settings.php';
require_once '../../sys/inc/db_connect.php';
require_once '../../sys/inc/ipua.php';
require_once '../../sys/inc/fnc.php';
require_once '../../sys/inc/user.php';
$set['title'] = 'Файлы';
require_once '../../sys/inc/thead.php';
aut();
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
} else {
$id = $user['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 "<a href='/user/files/edit.php?id=0&act=new'><div class='foot'><img src='/style/icons/folder--plus.png' /> Создать папку</div></a>";
}
$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 "<table class = 'foot'><tr><td class = 'null'>";
echo "<img src = '/style/icons/bullet_error.png' /> Папка пуста";
echo "</td></tr></table>";
}
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` 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 "<table class = 'foot'><tr><td class = 'null'>";
if ($id == $user['id']) {
echo "<div class = 'right' id = 'hide'>";
echo "<a href='/user/files/edit.php?id=$post[id]&act=rename'><img src='/style/icons/pencil.png' /></a> ";
echo "<a href='/user/files/edit.php?id=$post[id]&act=delete'><img src='/style/icons/cross.png' /></a>";
echo "</div>";
}
echo "<img src='/style/icons/folder(2).png' /> <a href='/user/files/dir.php?id=$id&dir=$post[id]'>" . htmlentities($post['name'], ENT_QUOTES, 'UTF-8') . "</a> ($k_f)";
echo "</td></tr></table>";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
require_once '../../sys/inc/tfoot.php';