<?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']='Смайлы '.$_SERVER['HTTP_HOST'];
include_once '../sys/inc/thead.php';

title();
aut();

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

if(!isset($user)){
	echo '<div class="err">Доступ закрыт</div>';
	}else{

if($user['level']<0){
	$ty = ' WHERE `level` = $user[level]';
	}

echo 'Директории смайлов:</b><br/>';

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_dir`$ty"),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 '<div class="err">Нет директорий.</div>';
	}

$q=mysql_query("SELECT * FROM `smiles_dir`$ty ORDER BY `pos` ASC  LIMIT 20");
while($post = mysql_fetch_array($q)){
	$smile = mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_spis` WHERE `id_dir` = '$post[id]'"),0);
	echo '<a href="dir.php?id='.$post['id'].'">'.esc(stripcslashes(htmlspecialchars($post['name']))).'</a> ('.$smile.')<br/>';
	}


	}

echo '</div>';


if(isset($_SESSION['refer']) && $_SESSION['refer']!=NULL && otkuda($_SESSION['refer']))
{
echo "<div class=\"foot\">\n";
echo "&laquo;<a href='$_SESSION[refer]'>".otkuda($_SESSION['refer'])."</a><br />\n";

}

echo"<a href='javascript:history.back(1)'>Назад</a><br/></DIV>";

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