<?php
#####################################
#  Coded in Pirate Technologies(C)  #
#  ///////////////////////////////  #
# ICQ: 854141                       #
# http://phpme.ru                   #
# http://angelcorpse.free-lance.ru  #
#####################################
require '../system/start.php';
require '../system/functions.php';
$query = mysql_fetch_assoc(mysql_query("select `id`,`login` from `users` where `id` = ".int($_GET['id']).""));
$str['mesto'] = 'Дневники';
$str['block'] = $set['site'].' / Дневники / Пользователь '.$query['login'];
include '../style/'.$style.'/head.php';
if(empty($query['login']))
{
	echo '<div class="on">Пользователь не найден!</div>';
	include '../style/'.$style.'/foot.php';
	exit;
}
if($user['id'] == $query['id'])
{
	echo '<div class="where"><a href="add_record.php">Добавить запись</a></div>';
}
$rec = mysql_query("select * from `blogs_records` where `id_user` = ".$query['id']."");
$total = mysql_result(mysql_query("select count(*) from `blogs` where `id_user` = ".$query['id'].""),0);
echo '<div class="where">&raquo; <b>Дневник</b> <a href="../p/'.$query['login'].'">'.$query['login'].'</a><br/>
&raquo; <b>Записей</b>: '.$total.'</div>';
if($total == 0)
{
	echo '<div class="on">Записей нет!</div>';
}

if ($page == 0) {  $post_number = 1 * $set['str'] - ($set['str']-1); } else { $post_number = 1 * $set['str'] - ($set['str']-1) + $page; }
while($row = mysql_fetch_assoc($rec))
{
	$i++;
	if($i%2)
	{
		echo '<div class="forum1">';
	}
	else
	{
		echo '<div class="forum2">';
	}
	$result = mysql_result(mysql_query("select count(*) from `blogs_comments` where `id_record` = ".$row['id'].""),0);
	echo '<b>'.$post_number.'</b>. <a href="view.php?id='.$row['id'].'">'.$row['title'].'</a> ('.clock($row['time']).')<br/>
	<img src="/style/'.$style.'/ico/comments.png" alt="" /> <a href="comments.php?id=16">Коментарии</a> (<b>'.$result.'</b>)<br />
	 <b>Рейтинг</b> ('.$row['rate'].')</div></div>';
	$post_number++;
}

echo '<div class="on2">
<img class="ico" src="../style/'.$style.'/ico/newpost.png" alt="" />
<a href="index.php">Все дневники </a>('.mysql_result(mysql_query("select count(*) from `blogs`"),0).')<br/>
</div>';
include '../style/'.$style.'/foot.php';
?>