<?
echo $fs1;

$que = @mysql_query("select * from  `forum_sections` where id='$id';" );
$dtm = @mysql_fetch_array( @$que );
$f_name = $dtm['name'];
if (mysql_affected_rows() == 0){
echo $fs1;
echo '<br /><b>Такого форума не существует!</b>';
echo $fs2;
foot();
exit;
}




echo '<dl><dt></dt></dl><a href='.F.'>Форумы</a>|<b>'.$f_name.'</b><br /><dl><dt></dt></dl>';
echo '<b>Разделы форума:</b>';

if (empty($row['max'])) $row['max']=10;
$max = $row['max'];
$k_post=mysql_result(mysql_query("select COUNT(*) from `forum_subfor` WHERE section = '".$id."';"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;



$q1 = mysql_query("SELECT * from `forum_subfor` WHERE section = '".$id."' order by pos limit $start,$max;" );
$k = mysql_num_rows($q1);

if ( $k == 0 )
{
echo '<b>Здесь разделов пока нет :)</b><br />';
}
while ($dtm = @mysql_fetch_array($q1))
{

$sf = $dtm['id'];
$f_name = $dtm['name'];

$q3 = mysql_query("select * from `forum_message` WHERE section = '$id' and subfor = '$sf';");
$num = mysql_num_rows($q3);
$qw = @mysql_query("select * from  `forum_topic` WHERE section = '$id' and subfor = '$sf';");
$kol = mysql_num_rows($qw);
$q = @mysql_query("select * from  `forum_topic` WHERE section = '$id' and subfor = '$sf' order by time desc limit 1;");
$q = @mysql_query("select * from  `forum_topic` WHERE section = '$id' and subfor = '$sf' order by time desc limit 1;");
$tem = @mysql_fetch_array($q);
echo '<br /><br />';


echo $div2;
if ($row['level']>=7) {
echo '<a href='.F.'admin/sf3/'.$sf.'><img src='.H2.'img/p2.png alt=*/></a> <b><a href='.F.'temes/'.$sf.'>'.$f_name.'</a></b> ('.$kol.'/'.$num.') <a href='.F.'temes/'.$sf.'/end>&gt;&gt;</a>';
} else{
echo '<img src='.H2.'img/p2.png alt=*/> <b><a href='.F.'temes/'.$sf.'>'.$f_name.'</a></b> ('.$kol.'/'.$num.') <a href='.F.'temes/'.$sf.'/end>&gt;&gt;</a>';
}
echo $div9;
echo 'Тема: <a href='.F.'tema/'.$tem['id'].'/end>'.$tem['name'].'</a><br />';
$time = $tem['time'];

$post = @mysql_fetch_array(mysql_query("select * from  `forum_message` WHERE topic = '".$tem['id']."' order by time desc limit 1;"));
$sect4 = @mysql_fetch_array(mysql_query( @"select * from  `users` WHERE id = '$post[login]' ;" ));
if($autorize) {
echo 'Сообщение: <a href='.H2.''.$sect4['id'].'>'.$sect4['user'].'</a>';
}else{
echo 'Сообщение: '.$sect4['user'].'';
}
print date("(d.m в H:i", $time).')';
}


echo '<br/><dl><dt></dt></dl>';
if ($k_page>1)str2("".F."subfs/$id",$k_page,$page); // Вывод страниц
echo '<br/><dl><dt></dt></dl>';
if ($row['level']>=7) {echo '<br /><dl><dt></dt></dl>';echo '<img src='.H2.'img/add.png alt=[ADD]/> <a href='.F.'admin/sf1/'.$id.'><b>Создать</b></a><br/>';}
echo $fs2;


?>