<?
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 "<div class=\"head\"><b>Мои темы</b></div><div class=\"main\">";  

$all = mysql_result(mysql_query("SELECT count(*) FROM `forum_themes` 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_themes WHERE `user_id` = '".$id_session."' ORDER BY `time` DESC limit ".$start.",".$onpage."");

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

$all_posts = mysql_result(mysql_query("SELECT count(*) FROM `forum_msg` WHERE `theme` = '$themes[id]'"), 0);

echo "<div class='link2'><img src=\"../images/document.png\" alt=\".\"/> <a href=\"theme.php?razdel=".$themes['razdel_id']."&pod_forum=".num($themes['pod_forum'])."&theme=".$themes['id']."\">".$themes['name']."</a> [".$all_posts."]</div>"; 


}

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


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