Файл: vsime.com/smiles/inc/act_index.php
Строк: 49
<?
if (isset($_GET['cat']))
{
$cat = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `id` = '".intval($_GET['cat'])."' AND `type` = 'cat'"));
if ($cat == NULL)
{
$title .= ' - Ошибка!';
ex_head();
$error[] = 'Категория не найдена.';
show_errors();
ex_foot();
}
ex_head();
$count_results = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `type` = 'smile' AND `id_cat` = '$cat[id]'"));
$count_pages = count_pages($count_results);
$page = page();
$start = start_pages();
if ($count_results == 0)
{
echo "<div class='list'>n";
echo "Нет смайловn";
echo "</div>n";
}
$query = mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `type` = 'smile' AND `id_cat` = '$cat[id]' ORDER BY `id` ASC LIMIT $start, $config[rop]");
while ($post = mysqli_fetch_array($query))
{
$post['explode_name'] = explode(",", $post['name']);
$post['name'] = array();
foreach($post['explode_name'] AS $key => $name)
{
$post['name'][] = $name;
}
$post['name'] = implode(" ", $post['name']);
echo "<div class='list'>n";
echo "<img src='/i/smiles/$post[id].$post[image]' /> $post[name]n";
echo "</div>n";
}
pages_show("?cat=$cat[id]&");
echo "<div class='foot'>n";
echo "» <a href='/smiles'>Список категорий</a>n";
echo "</div>n";
ex_foot();
}
ex_head();
$count_results = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `type` = 'cat'"));
$count_pages = count_pages($count_results);
$count_pages = count_pages();
$page = page();
if ($count_results == 0)
{
echo "<div class='list'>n";
echo "Нет категорийn";
echo "</div>n";
}
$query = mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `type` = 'cat'");
while ($post = mysqli_fetch_array($query))
{
echo "<div class='list'>n";
$smile = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `id_cat` = '$post[id]' ORDER BY rand()"));
if ($smile != NULL)
{
echo "<div class='left'>n";
echo "<img src='/i/smiles/$smile[id].$smile[image]' />n";
echo "</div>n";
}
echo "<a href='?cat=$post[id]'>".htmlspecialchars($post['name'])."</a> (".mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `smiles` WHERE `type` = 'smile' AND `id_cat` = '$post[id]'")).")n";
echo "<div class='clear'></div>n";
echo "</div>n";
}
pages_show("?");
ex_foot();
?>