<?php

define ('_CONSTANT_', 1);

require_once '../../core/start.php';

checkAuth();

head('Смайлы', 'Смайлы');

$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM " . SMILES . "");

if (empty($all)) 
{
    error('Смайлов нет', '/', 'На главную');
} 
else 
{
    $n = new Navigator($all,10,''); 
    $sql = DB::$dbs->query("SELECT * FROM " . SMILES . " ORDER BY `id` DESC LIMIT {$n->start()}, 10");

    echo DIV_CONTENT;
    while ($smile = $sql -> fetch()) 
    {
        ?> 
        <?=$smile['name']?> -> <img src="<?=HOME?>/img/smiles/<?=$smile['url']?>" /><br/>
        <?php
    } 
    echo CLOSE_DIV; 
    echo $n->navi();
} 

require_once '../../core/foot.php';