<?php
// ENK by wap-mast.ru
// icq 609554069
require '../sys/inc/start.php';
require '../sys/inc/compress.php';
require '../sys/inc/sess.php';
require '../sys/inc/home.php';
require '../sys/inc/settings.php';
require '../sys/inc/db_connect.php';
require '../sys/inc/ipua.php';
require '../sys/inc/fnc.php';
require '../sys/inc/user.php';
$blog=mysql_fetch_array(mysql_query("select * from `blog_list` where `id`='".intval($_GET['id'])."';"));
################################################################################
if(!isset($_GET['id']))
{
$set['title']='Ошибка';
require '../sys/inc/thead.php';
title();
errs('Нет такой записи!');
echo "<div class='fyt'>\n";
echo "• <a href='index.php'>Дневники</a><br />\n";
echo "</div>\n";
require '../sys/inc/tfoot.php';
exit();
}
################################################################################
$id = intval($_GET['id']);
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_list` WHERE  `id` = '".intval($_GET['id'])."'"),0) ==0)
{
$set['title']='Ошибка';
require '../sys/inc/thead.php';
title();
errs('Нет такой записи!');
echo "<div class='fyt'>\n";
echo "• <a href='index.php'>Дневники</a><br />\n";
echo "</div>\n";
require '../sys/inc/tfoot.php';
exit();
}

if($blog['read']==2 && ($user['level']<4) && ($user['id'] !=$blog['id_user']))
{
$set['title']='Закрыто';
require '../sys/inc/thead.php';
title();
errs('Личный Дневник!');
echo "<div class='fyt'>\n";
echo "• <a href='index.php'>Дневники</a><br />\n";
echo "</div>\n";
require '../sys/inc/tfoot.php';
exit();
}
################################################################################
$ank=get_user($blog['id_user']);
$set['title']="Дневник » $ank[nick]";
require '../sys/inc/thead.php';
title();
err();
################################################################################
if (($user['level']>=4) || ($user['id']==$blog['id_user']))
{
echo "<div class='fyt'>\n";
echo "<a href='edit.php?id=$blog[id]'>Редактировать</a> / <a href='edit.php?id=$blog[id]&amp;del'>Удалить</a>";
echo "</div>\n";
}
################################################################################
echo "<div class='enk2_div'>\n";
echo "".status($ank['id'])." \n";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a> (".vremja($blog['time']).")<br />\n";
echo "</div>\n";
echo "<div class='enk2_div'>\n";
echo "<b>".output_text($blog['name'])."</b></span>\n";
echo "<br />".output_text($blog['msg'])."\n";
echo "</div>\n";
echo "<div class='enk_div'>\n";
echo "<img src='images/21.gif'> <a href='komm.php?id=$blog[id]'>Комментарии</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id_blog` = '$blog[id]'"),0).")";
echo "</div>\n";
echo "<div class='fyt'>\n";
echo "«<a href='index.php'>В Дневники</a><br />\n";
echo"</div>\n";
require '../sys/inc/tfoot.php';
?>