<?
$DIR = $_SERVER["DOCUMENT_ROOT"];
include_once $DIR.'/sys/inc/start.php';
include_once $DIR.'/sys/inc/compress.php';
include_once $DIR.'/sys/inc/sess.php';
include_once $DIR.'/sys/inc/home.php';
include_once $DIR.'/sys/inc/settings.php';
include_once $DIR.'/sys/inc/db_connect.php';
include_once $DIR.'/sys/inc/ipua.php';
include_once $DIR.'/sys/inc/fnc.php';
include_once $DIR.'/sys/inc/user.php';
only_reg();

if (!isset($user) && !isset($_GET['id'])){header("Location: /index.php?".SID);exit;}
if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: /index.php?".SID);exit;}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $ank[id] LIMIT 1"));
$set['title']=" Рефералы/$ank[nick] ";

include_once $DIR.'/sys/inc/thead.php';
title();
err();
if(isset($user) && $user['id']!==$ank['id']) echo "<div class='prof'>".img('index/ic_gp35.gif')." <a href='us_ref.php?id=$user[id]'>Мои рефералы</a></div>";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `ref_user` WHERE `nick` = '$ank[id]'"),0);
$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 `ref_user` WHERE `nick` = '$ank[id]' ORDER BY id DESC LIMIT $start, $set[p_str]");
if($k_post == 0) echo '<div class="ankus">Нет рефералов</div>';
while ($post = mysql_fetch_assoc($q))
{
$ank=get_user($post['id_user']);
$nncool=get_user($post['nick']);
echo '  <div class=\'ankus\'>';
echo ' '.img('index/6_o.gif').'  <a href=\'/info.php?id='.($ank['id']).'\'>'.($ank['nick']).'</a>';
echo '  </div>';


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


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