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

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

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

echo head . "<b>Мои сообщения</b>" . div;  

$all = mysql_result(mysql_query("SELECT count(*) FROM `forum_msg` WHERE `user_id` = '".$id_session."'"), 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` = '".$id_session."' 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,"my_posts.php?p={p}",1,1);
echo div;
}


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