<?
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';
only_reg();
$set['title']='Гости'; // заголовок страницы
include_once '../../sys/inc/thead.php';

title();
aut();
echo "<div class=\"foot\">\n";echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/info.php?id=$user[id]'>$user[nick]</a> | \n";echo '<b>Гости</b>';echo "</div>\n";
$new=mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `id_ank` = '$user[id]' AND `read`='1'"),0);
if($new!=0){
mysql_query("UPDATE `my_guests` SET `read`='0' WHERE `id_ank`='$user[id]' AND `read`='1' LIMIT $new");}

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `id_ank` = '$user[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)echo'Вашу страничку еще не посещали<br/>';
echo'<table class="post">';
$q=mysql_query("SELECT * FROM `my_guests` WHERE `id_ank` = '$user[id]' ORDER BY `id` DESC  LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
$ank=get_user($post['id_user']);
/*-----------зебра-----------*/ 
if ($num==0){
	echo '<div class="nav1">';
	$num=1;
}elseif ($num==1){
	echo '<div class="nav2">';
	$num=0;
}
/*---------------------------*/

echo status($ank['id']);


echo ' '.group($ank['id']).' <a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a> '.medal($ank['id']).' '.online($ank['id']).' ('.(($ank['pol']==1)?'М':'Ж').') '.$post['count'].' раз<br />';

/*------------Вывод статуса-------------*/
$status=mysql_fetch_assoc(mysql_query("SELECT * FROM `status` WHERE `pokaz`  = '1' AND `id_user` = '$ank[id]' LIMIT 1"));
if ($status['msg'] && $set['st']==1){	
	echo "<div class='st_1'></div>";	
	echo "<div class='st_2'>";	
	echo output_text($status['msg']);	
	echo "</div>\n";
}
/*---------------------------------------*/


echo " <a href=\"/mail.php?id=$ank[id]\"><img src='/style/icons/pochta.gif' alt='*' /> Сообщение</a> \n";
echo'('.vremja($post['time']).')';
echo '</div>';
}
echo'</table>';
if ($k_page>1)str("?",$k_page,$page); /* Вывод страниц */

echo "<div class=\"foot\">\n";
echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/info.php?id=$user[id]'>$user[nick]</a> | \n";
echo '<b>Гости</b>';
echo "</div>\n";

include_once '../../sys/inc/tfoot.php';
?>