<?
include '../config.php';
include '../func.php';
head();
ban();

/////////////////////////////
if (! $id_session ) {
    
    echo 'Вы не авторизованы<br/>';
    echo '</div>';
pod_navig();
foot();
exit();
}

$id = num($_GET['id']);
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `profile` WHERE `id` = '".$id."'"));

if ( $id_session )
mysql_query("UPDATE `profile` SET `online` = 'forum' WHERE `id` = '".$id_session."'");

echo head . "Посты пользователя: <b>".$user['login']."</b>" . div;  

$all = mysql_result(mysql_query("SELECT count(*) FROM `forum_msg` WHERE `user_id` = '".$user['id']."'"), 0);

if ( $all == 0) {
    echo 'Темы еще не созданы.<br/>';
    pod_navig();
    foot();
    exit();
    
}

if($all){
$onpage = $set_themes_session;
$allpage = ceil($all/$onpage);
$this_page = (isset($_GET['p'])) ? intval($_GET['p']) : 1 ;
if($this_page < 1 || $this_page > $allpage)$this_page = 1;
$start = $this_page*$onpage - $onpage;

$result = mysql_query("SELECT * FROM `forum_msg` WHERE `user_id` = '".$user['id']."' ORDER BY `id` DESC limit ".$start.",".$onpage."");

while($post = mysql_fetch_assoc($result)){

echo link2;

echo smile(adminbb(parsebb($post['msg'])))."<br/>"; 

$theme = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '".$post['theme']."'"));

echo '<a href="theme.php?razdel='.$post['razdel_id'].'&pod_forum='.$post['pod_forum'].'&theme='.$post['theme'].'">Перейти в тему <b>'.$theme['name'].'</b></a>';
echo div;
}

echo link1 . '<b>Страницы:</b> ';
navigation($allpage,"puser.php?p={p}",1,1);
echo div;
}


echo '</div>';
pod_navig();
foot();
?>