<?
include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
include_once 'sys/inc/user.php';
only_reg();

include_once 'sys/inc/thead.php';
title();
echo "<div class='rekl'>";
echo "<img src='/forum/forum.gif' alt='' /> <b>Мои закладки</b>";
echo "</div>\n";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_zakl` WHERE `id_user` = '$user[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>\n";
if ($k_post==0)
{

echo "Нет закладок\n";

}
$q=mysql_query("SELECT * FROM `forum_zakl` WHERE `id_user` = '$user[id]' ORDER BY `time_obn` DESC LIMIT $start, $set[p_str]");
while ($zakl = mysql_fetch_assoc($q))
{
echo "   <tr>\n";
if ($user['zebra_forum']==0)
{
if($num==1){ 
echo "<td class='linechat'>"; 
$num=0;
}else{ 
echo "<td class='linechat'>"; 
$num=1;}
}

if ($user['zebra_forum']==1)
{
if($num==1){ 
echo "<td class='forumwup'>"; 
$num=0;
}else{ 
echo "<td class='forumdiv'>"; 
$num=1;}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE `id` = '$zakl[id_them]' LIMIT 1"),0)==1)
{

$them=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_t` WHERE `id` = '$zakl[id_them]' LIMIT 1"));
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_f` WHERE `id` = '$them[id_forum]' LIMIT 1"));
$razdel=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_r` WHERE `id` = '$them[id_razdel]' LIMIT 1"));
echo "Темa:";
echo " <img src='/style/themes/$set[set_them]/forum/14/them_$them[up]$them[close].png' />";

$k_p=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_them` = '$them[id]'"),0);
$k_n_p=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_them` = '$them[id]' AND `time` > '$zakl[time]'"),0);

$page_z=k_page($k_p-$k_n_p+1,$set['p_str']);
if ($k_n_p==0)$k_n_p=NULL;else $k_n_p="/+$k_n_p";

echo " <a href='/forum/$forum[id]/$razdel[id]/$them[id]/?page=$page_z'>$them[name] </a>($k_p$k_n_p постов)</a><br />\n";

$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $them[id_user] LIMIT 1"));
echo "Автор: <a href='/info.php?id=$ank[id]' title='Анкета \"$ank[nick]\"'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a> <font color='#afb0a3'>(".vremja($them['time_create']).")</font><br />\n";

$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' ORDER BY `id` DESC LIMIT 1"));
$ank2=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo "Сообщение: <a href='/info.php?id=$ank2[id]' title='Анкета \"$ank2[nick]\"'><span style=\"color:$ank2[ncolor]\">$ank2[nick]</span></a> <font color='#afb0a3'>(".vremja($post['time']).")</font><br />\n";

}}
echo "</table>\n";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
echo "<div class='p_t'>\n";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href='umenu.php'>Мое меню</a><br/>\n";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href='/forum/'>Форум</a>\n";
echo "</div>\n";
include_once 'sys/inc/tfoot.php';
?>
