Файл: jokes/cat.php
Строк: 52
<?php
include_once '../sys/inc/home.php';
include_once H.'sys/inc/start.php';
include_once H.'sys/inc/compress.php';
include_once H.'sys/inc/sess.php';
include_once H.'sys/inc/settings.php';
include_once H.'sys/inc/db_connect.php';
include_once H.'sys/inc/ipua.php';
include_once H.'sys/inc/fnc.php';
include_once H.'sys/inc/user.php';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `jokes_cat` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"),0)==0){header("Location: /index.php?".SID);exit;}
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `jokes_cat` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));
$set['title']="Анекдоты - Категории - ".htmlspecialchars($cat['name']);
include_once H.'sys/inc/thead.php';
title();
aut();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `jokes` WHERE `id_cat` = '".intval($_GET['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)
{
msg("В этой категории нет анекдотов");
}
$q=mysql_query("SELECT * FROM `jokes` WHERE `id_cat` = '$cat[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($joke=mysql_fetch_array($q)){
$ank=get_user($joke['id_user']);
echo "<a href='joke.php?id=".$joke['id']."'><div class='nav2'><img src='img/joke.png'> ".htmlspecialchars($joke['name'])." | <img src='img/view.png'> $joke[view]<br/><b>$ank[nick]</b> | <b>".vremja($joke['time'])."</b></div></a>";
}
if ($k_page>1)str('?id='.$cat['id'].'&',$k_page,$page);
echo "<a href='catlist.php'><div class='foot'><img src='/style/icons/str2.gif'> Категории</div></a>";
include_once H.'sys/inc/tfoot.php';
?>