<?php
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.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';

$set['title']='FM Журнал';

include_once '../../sys/inc/thead.php';
title();

mysql_query("UPDATE `fm_jurnal` SET `read` = '1' WHERE `id_user` = '$user[id]' AND `read` = '0'");


///////////////////Очистить журнал/////////////////////////////////
if (isset($user)){
if (isset($_GET['clean']))
{
mysql_query("DELETE FROM `fm_jurnal` WHERE `id_user` = '$user[id]'");
mysql_query("OPTIMIZE TABLE `fm_jurnal`");
}
}
///////////////////////////////////////////////

aut();

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `fm_jurnal` WHERE `id_user` = '$user[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 `fm_jurnal` WHERE `id_user` = '$user[id]' ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{

if($num==1){
echo "<div class='f1'>";
$num=0;}
else{
echo "<div class='f2'>";
$num=1;}

echo "[".vremja($post['time'])."]\n";
echo output_text($post['msg'])."<br />";

echo "</div>";

}



if ($k_page>1)str("jurnal.php?",$k_page,$page);

if ($k_post==0)
{
echo "<div class='menu'>Нет событий!</div>\n";
}
else
{
if (isset($user))echo "<div class='title'>[<a href='jurnal.php?clean'>Очистить журнал</a>]</div>\n";
}
echo "<div class='foot'>";
echo "&#171; <a href='index.php'>Назад</a><br/>";
echo "</div>";
include_once '../../sys/inc/tfoot.php';
?>
