<?
echo 'Новые <a href="new_t">Темы</a> | <a href="new_p">Сообщения</a><br />';
if($user['id']!=""){ echo 'Мои <a href="my_t">Темы</a> | <a href="my_p">Сообщения</a> | <a href="bookmarks_0">Закладки</a><br/>';}
echo '<dl><dt></dt></dl>';


echo '<b>Форумы:</b>';

$q = @$db->sql_query("select * from  `forum_f` order by pos" );
while ($for = @$db->sql_fetchrow($q))
{
$f = $for['id'];
$f_name = $for['name'];

$num = $db->sql_numrows($db->sql_query("select * from `forum_msg` WHERE f_id = '$f';"));
$kol = $db->sql_numrows($db->sql_query("select * from  `forum_t` WHERE f_id = '$f';"));

$tem = @$db->sql_fetchrow($db->sql_query("select * from  `forum_t` WHERE f_id = '$f' order by time desc limit 1;"));

echo '<dl></dl>';


echo links;
if ($user['level']>=7) {
echo '<a href="admin_editf_'.$f.'"><img src="'.H.'img/p2.png" alt="*"/></a> <b><a href="razdel_'.$f.'">'.$f_name.'</a></b> ('.$kol.'/'.$num.') <a href="razdel_'.$f.'_end">&gt;&gt;</a>';
} else{
echo '<img src="'.H.'img/p2.png" alt="*"/> <b><a href="razdel_'.$f.'">'.$f_name.'</a></b> ('.$kol.'/'.$num.') <a href="razdel_'.$f.'_end">&gt;&gt;</a>';
}
echo div;
echo '<small>';
if ($user['razd']==1){
$q1 = $db->sql_query('SELECT * from `forum_r` WHERE f_id = "'.$f.'" order by pos limit 10;');
while ($for = @$db->sql_fetchrow($q1))
{
echo '<img src="'.H.'img/004.png" alt="*"/> <a href="temes_'.$for['id'].'">'.$for['name'].'</a> ('.$db->sql_fetchfield($db->sql_query("SELECT COUNT(*) FROM `forum_t` WHERE `f_id` = '$f' AND `r_id` = '".$for['id']."'"),0).'/'.$db->sql_fetchfield($db->sql_query("SELECT COUNT(*) FROM `forum_msg` WHERE `f_id` = '$f' AND `r_id` = '".$for['id']."'"),0).')<br />';
}
}

$k = @$db->sql_fetchrow($db->sql_query('SELECT * from `forum_r` WHERE id = "'.$tem['r_id'].'";'));
echo 'Раздел: <a href="temes_'.$tem['r_id'].'">'.$k['name'].'</a><br />Тема: <a href="tema_'.$tem['id'].'_end">'.$tem['name'].'</a><br />';


$post = @$db->sql_fetchrow($db->sql_query("select * from  `forum_msg` WHERE t_id = '".$tem['id']."' order by time desc limit 1;"));
echo 'Сообщение: <a href="'.H.user_inf($post['user_id']).'">'.user($post['user_id']).'</a>';

echo '('.times($post['time']).')';
echo '</small>';
}


if ($user['level']>=7) {echo '<br /><br /><dl><dt></dt></dl>';echo '<a href="admin_addf"><b>Создать</b></a><br/>';

}
echo '<dl><dt></dt></dl>';

?>