<?
echo $fs1;




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

$que = @mysql_query( "select * from  `forum_sections` where id='$f';" );
$dtm = @mysql_fetch_array( @$que );
$f_name = $dtm['name'];

//mysql_query ("Update users set  for='".$f."', sfor='".$id."', tema='0' where id = '".$row['id']."'");

echo ' <dl><dt></dt></dl><a href='.F.'>Форумы</a>|<a href='.F.'subfs/'.$f.'>'.$f_name.'</a>|<b>'.$s_name.'</b><br />';
if($autorize) echo '<dl><dt></dt></dl><img src='.H2.'img/k.gif alt=*/> <a href='.F.'addtem/'.$id.'><b>Новая тема</b></a><br /><dl><dt></dt></dl>';
echo '<b>Темы раздела:</b><br />';

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


$q1 = mysql_query( "SELECT * from `forum_topic` WHERE  subfor = '$id' order by zak desc,time desc limit $start,$max;" );
$k = mysql_num_rows($q1);

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



$time = $topic['time'];
$t = $topic['id'];
$q3 = mysql_query( "select id from forum_message where topic = '$t' and subfor = '$id'" );
$num = mysql_num_rows($q3);



if ($topic['close'] == 1) $gif = 'zakr';
else if ($topic['zak'] == 1) $gif = 'lock';
else  $gif = 'tem';
echo '<br />';
echo $div2;
if ($row['level']>=7) {
echo '<a href='.F.'admin/s7/'.$t.'><img src='.H2.'img/'.$gif.'.gif alt=*/></a> ';
}else{
echo '<img src='.H2.'img/'.$gif.'.gif alt=*/> ';
}



echo '<b><a href='.F.'tema/'.$t.'/>'.$topic['name'].'</a></b> ('.$num.') <a href='.F.'tema/'.$t.'/end>&gt;&gt;</a>'.$div9;
$files=mysql_result(mysql_query("select COUNT(*) from `forum_message` WHERE  topic = '$t' and fale != '';"),0);
if ($files>0)echo 'Вложений: <a href="'.F.'files/'.$t.'/">'.$files.'</a><br />';

$sect3 = @mysql_fetch_array(@mysql_query( @"select * from  `users` WHERE id = '".$topic['login']."' ;" ));

$post = @mysql_fetch_array(mysql_query("select * from  `forum_message` WHERE topic = '".$t."' order by time desc limit 1;"));
$sect4 = @mysql_fetch_array(mysql_query( @"select * from  `users` WHERE id = '$post[login]' ;" ));
echo '<a href='.H2.$sect3['id'].'>'.$sect3['user'].'</a> / <a href='.H2.$post['login'].'>'.$sect4['user'].'</a>';


print date("(d.m в H:i", $time).')';

echo '<br/>';
}
echo '<br/><dl><dt></dt></dl>';
if ($k_page>1)str2("".F."temes/$id",$k_page,$page); // Вывод страниц
echo '<br/><dl><dt></dt></dl>';
echo $fs2;


?>