<?

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();



$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']);

echo'<tr>';



if ($set['set_show_icon']==2){

echo'<td class="icon48" rowspan="2">';

avatar($ank['id']);

echo'</td>';

}

elseif ($set['set_show_icon']==1)

{

echo'<td class="icon14">';

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

echo'</td>';

}

echo'<td class="p_t">';

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'].' раз';



echo "<br />\n";

echo'</td>';

echo'</tr>';

echo'<tr>';

if ($set['set_show_icon']==1)echo'<td class="p_m" colspan="2">'; else echo '<td class="p_m">';

echo " <a href=\"/mail.php?id=$ank[id]\"><img src='/style/icons/pochta.gif' alt='*' /> Сообщение</a> \n";

echo'('.vremja($post['time']).')';

echo'</td>';

echo'</tr>';

}

echo'</table>';

if ($k_page>1)str("?",$k_page,$page); // Вывод страниц

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

?>