<?
include_once '../sys/inc/start.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';
include_once '../sys/inc/thead.php';
if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
$ank=get_user($ank['id']);
$set['title']=$ank['nick'].' сообщения  ';
if(!$ank){header("Location: /index.php?".SID);exit;}
title();
aut();

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p`  WHERE `id_user` = '$ank[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];


$q=mysql_query("SELECT * FROM `forum_p` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC  LIMIT $start, $set[p_str]");
echo "<table class='post'>\n";
if (mysql_num_rows($q)==0) {
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Нет сообщений в форуме\n";
echo "  </td>\n";
echo "   </tr>\n";
}

while ($them = mysql_fetch_array($q))
{
$forum=mysql_fetch_array(mysql_query("SELECT * FROM `forum_f` WHERE `id` = '$them[id_forum]' LIMIT 1"));
$razdel=mysql_fetch_array(mysql_query("SELECT * FROM `forum_r` WHERE `id` = '$them[id_razdel]' LIMIT 1"));
$them1=mysql_fetch_array(mysql_query("SELECT * FROM `forum_t` WHERE `id` = '$them[id_them]' LIMIT 1"));
echo "   <tr>\n";
if ($set['set_show_icon']==2){
echo "  <td class='icon48' rowspan='2'>\n";
avatar($ank['id']);
echo "  </td>\n";
}
elseif ($set['set_show_icon']==1)
{
echo "  <td class='icon14'>\n";
echo "".status($ank['id'])."";
echo "  </td>\n";
}


echo "  <td class='p_t'>\n";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a>".online($ank['id'])." (".vremja($them['time']).")<br />\n";
echo "  </td>\n";
echo "   </tr>\n";
echo "   <tr>\n";
if ($set['set_show_icon']==1)echo "  <td class='p_m' colspan='2'>\n"; else echo "  <td class='p_m'>\n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($them['msg']))))))))."<br />\n";
echo "<a href='/forum/'>Форум</a> -> <a href='/forum/$forum[id]/'>$forum[name]</a> -> <a href='/forum/$forum[id]/$razdel[id]/'>$razdel[name]</a><br />\n";
echo "  </td>\n";
echo "   </tr>\n";
}
echo "</table>\n";

if ($k_page>1)str("?id=$ank[id]&amp;",$k_page,$page); // Вывод страниц


include_once '../sys/inc/tfoot.php';

?>