Файл: pages/smiles/dir.php
Строк: 43
<?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';
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
} else {
    header("Location: /index.php");
}
$set['title'] = 'Смайлы';
require_once '../../sys/inc/thead.php';
aut();
err();
$dir = mysql_fetch_array(mysql_query("SELECT * FROM `smiles_dir` WHERE `id` = '" . $id . "'"));
if (!isset($user)) {
    err('Доступ закрыт');
} else if ($id == 0 || $id < 0) {
    err('Директория не найдена');
} else if ($id != $dir['id']) {
    err('Директория не найдена');
} else if ($user['level'] != $dir['level'] && $user['level'] < 0) {
    err('Эти смайлы не для Вас');
} else {
    echo "<div class = 'menu_razd'>Папка: " . esc(stripcslashes(htmlspecialchars($dir['name']))) . "</div>";
    $k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_spis` WHERE `id_dir` = '$id'"), 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>";
    }
    $q = mysql_query("SELECT * FROM `smiles_spis` WHERE `id_dir` = '$id' ORDER BY `id` ASC LIMIT $start, $set[p_str]");
    while ($post = mysql_fetch_array($q)) {
        echo "<table class = 'foot'><tr><td class = 'icon14'>";
        echo "<img src = '/style/icons/smiles/emotion_$post[name].png' alt = '$post[name]'/>";
        echo "</td><td class = 'null'>";
        echo "$post[sim]";
        echo "</td></tr></table>";
    }
    if ($k_page > 1) {
        str('dir.php?id=' . $id . '&', $k_page, $page);
    }
echo "<div class = 'foot'>";
echo "<img src = '/style/icons/left.png' /> <a href = 'index.php'>Все папки</a>";
echo "</div>";
}
require_once '../../sys/inc/tfoot.php';