<?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';

if(isset($_GET['id'])){$id = intval($_GET['id']);}else{header("Location: /index.php");}
$dir = mysql_fetch_array(mysql_query("SELECT * FROM `smiles_dir` WHERE `id` = '".$id."'"));
$set['title']="Смайлы/$dir[name]";
include_once '../sys/inc/thead.php';
title();
$set['p_str']="15";
$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 '<div class="nol">Нет смайлов</div>';}

$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)){
if($num==1){
echo '<div class="frends">';
$num=0;
}else{
echo '<div class="frends2">';
$num=1;}
echo '<img src="/style/smiles/'.$post['name'].'.gif" alt="'.$post['name'].'"/> '.$post['sim'].'<br />';
echo '</div>';
}

if($k_page>1){str('dir.php?id='.$id.'&amp;',$k_page,$page);}

echo '<div class="foot">&#187;&nbsp;<a href="index.php">Все директории</div></a>';
include_once '../sys/inc/tfoot.php';
?>