<?
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']="Друзья онлайн";
include_once 'sys/inc/thead.php';
title();

$ank['id'] = $user['id'];
if (isset($_GET['id']))$ank['id'] = intval($_GET['id']);
$q = mysql_query("SELECT * FROM `user` WHERE `id` = $ank[id] LIMIT 1");
if (mysql_num_rows($q)==0){header("Location: index.php?".SID);exit;}
$ank = mysql_fetch_array($q);
if (isset($_GET['add']))msg('Заявка отправлена');
?>
<div class='fyt'>
<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &raquo <a href='/info.php?id=<?echo $ank['id'];?>'><?echo $ank['nick'];?></a> &raquo Друзья онлайн
</div>
<?
################################################################################
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` INNER JOIN `user` ON `frends`.`frend`=`user`.`id` WHERE `frends`.`user` = '$ank[id]' AND `frends`.`i` = '1' AND `user`.`date_last`>'".(time()-600)."'"), 0);
if ($k_post==0)
{
?>
<div class='noy'>Нет друзей онлайн =(</div>
<?
}
$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 `frends` INNER JOIN `user` ON `frends`.`frend`=`user`.`id` WHERE `frends`.`user` = '$ank[id]' AND `frends`.`i` = '1' AND `user`.`date_last`>'".(time()-600)."' ORDER BY `user`.`date_last` DESC LIMIT $start, $set[p_str]");
while ($f = mysql_fetch_array($q))
{
$a=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[frend]' LIMIT 1"));
if($num==1){
echo "<div class='enk_div'>\n";
$num=0;
}else{
echo "<div class='enk2_div'>\n";
$num=1;}
echo "".avatar2($a['id'])."<br />";
echo "".on($a['id'])."\n";
echo "".pol($a['id'])."";
echo "<a href='/info.php?id=$a[id]'><span style='color:$a[ncolor]'>$a[nick]</span></a> \n";
echo "".vip($a['id'])."\n".medal($a['id'])."<br />";
if ($ank['id']==$user['id'])echo '<a href="frend_new.php?no='.$a['id'].'">Удалить из друзей</a>';
echo '</div>';
}

if ($k_page>1)str("?id=$ank[id]&amp;",$k_page,$page);
?>
<div class='fyt'>
<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &raquo <a href='/info.php?id=<?echo $ank['id'];?>'><?echo $ank['nick'];?></a> &raquo Друзья онлайн
</div>
<?
include_once 'sys/inc/tfoot.php';
?>