<?
include '../config.php';
include '../func.php';
head();
aut();
ban();
////////////////////////////////////////
mysql_query("UPDATE `profile` SET `online` = 'blog' WHERE `id` = '".$id_session."'");

echo head . "<b>Блоги</b>" . div;   

echo link1 . "<b><a href=\"add.php\">Добавить запись</a></b></div>";
$my_blogs = mysql_result(mysql_query("SELECT count(*) FROM `blogs` WHERE `user` = '".$id_session."'"), 0);
if ($my_blogs > 0) echo "<a href=\"blogs.php?user=".$id_session."\">Мой блог</a> [".$my_blogs."]<br/>";
echo div;

//echo kub . '<img src="../style/img/kub.gif" alt="" />' . div;

echo katalog . '<b>Люди пишут:</b>' . div;
//echo katalog;
$all = mysql_result(mysql_query("SELECT count(*) FROM `blogs`"), 0);
if ( $all > 0 ) {
    
if($all){
$onpage = 5;
$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 `blogs` order by id desc limit ".$start.",".$onpage." ");
while($blog = mysql_fetch_assoc($result)) {
    
    
    echo '<div class="link2">Запись: <a href="view.php?blog='.$blog['id'].'">'.mat($blog['top']).'</a><br/ >';
    echo ''.mat(substr($blog[msg], 0, 80)).'...</div>';
    
}

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




} else { 
    
    echo 'Записей нет';
    
}

echo div;


/////////////////////////////////////////

pod_navig();
foot();
?>