Файл: forum/forum.php
Строк: 19
<?php
include_once '../system/head.php';
$id = intval($_GET['id']);
$forums = mysql_query("SELECT * FROM `forum` WHERE `id` LIKE '$id'");
$temp = mysql_fetch_array($forums);
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `themes` WHERE `id_forum`='$id'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$new=@mysql_fetch_assoc(mysql_query("select * from `forum` order by `id` desc limit 1"));
$query = mysql_query("select * from `themes` WHERE `id_forum`='$id' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
$total = mysql_result(mysql_query("select count(*) from `themes` WHERE `id_forum`='$id'"),0);
if($id>$new[id] or !isset($id)){echo'<div class="pad">Ошибка</div>';}else{
echo'<div class="head"><a href="index.php">Форум</a> / '.$temp['name'].'</div>';
if($total == 0)
{
echo '<div class="pad">Тем еще нет.</div>';
}
else
{
while ($row = mysql_fetch_assoc($query))
{
$number++;
$id = intval($_GET['id']);
$posts = mysql_num_rows(mysql_query("SELECT id FROM `posts` WHERE `id_theme` = '$row[id]'"));
$authors = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$row[avtor]' "));
$theme = mysql_fetch_array(mysql_query('SELECT * FROM `themes` WHERE `id`='.$id.''));
echo '<div class="menu">'.$number.'. <a href="theme.php?id='.protect($row['id']).'">'.protect(trim($row['name'])).'</a> ('.$posts.')';
if($user['level']=='1'){
echo' <a href="/?mode=admin&fid=del_theme&id='.protect($row['id']).'">[del]</a>';}
echo'<br/><small>Автор - <a href="/profile'.$row['avtor'].'">'.$authors['login'].'</a></small></div>';
}
}
if($user)echo'<div class="menu"><a href="reply.php?mode=theme&id_forum='.$id.'">Новая тема</a></div>';}
if ($k_page>1)str('?id='.$id.'&',$k_page,$page); // Вывод страниц
require_once '../system/foot.php';
?>