<?

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';
$div="infosm";
$div2="infosm2";
#######################################################
if (isset($user))$ank['id']=$user['id'];###############
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);#
########################################################
if ($ank['id']==0)
{
$ank=get_user($ank['id']);
$set['title']="Ощибка!";
include_once 'sys/inc/thead.php';
title();
echo "<div class='err'>Ощибка!</div>\n";
include_once 'sys/inc/tfoot.php';
exit;
}
################################################################################
$ank=get_user($ank['id']);
if(!$ank){header("Location: /index.php?".SID);exit;}
################################################################################
$ank['rating']=intval(@mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"),0));
$set['title']=$ank['nick'].' - анкета '; // заголовок страницы
include_once 'sys/inc/thead.php';
title();
################################################################################
$sql = mysql_query("SELECT * FROM `blacklist` WHERE `user` = $ank[id] AND `lol` = $user[id];");
if(mysql_num_rows($sql) !=0 AND $user['level'] <3){
echo "<div class='err_'>Вы не можете просматривать страницу обитателя <b>$ank[nick]</b>. Вы добавлены в его черный список!</div>";
include_once 'sys/inc/tfoot.php';
exit;
}


/*=====================================*/
include_once 'settings/info/count.php';
/*=============================================*/

$mod_file=H.'mods/birja_pitomcev/info1.php';
if(is_file($mod_file))include $mod_file;
//------------------------------

################################################################################
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time'"), 0)!=0)
{
echo "<div class='err_'>\n";
$q=mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time' ORDER BY `time` DESC LIMIT 5");
while ($post = mysql_fetch_array($q))
{
echo "<u>Обитатель <b>$ank[nick]</b> забанен</u><br/>\n";
$q=mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time' ORDER BY `time` DESC LIMIT 5");
while ($post=mysql_fetch_assoc($q))
{
$kto=get_user($post['id_ban']);
echo "<u>Модератором:</u> <a href='/info.php?id=$kto[id]'>$kto[nick]</a><br />\n";
echo "<u>Причина бана:</u> <b>".output_text($post['prich'])."</b><br />\n";
////////////////////////////////////////////////////////////////////////////////
$test=$post['time']-time();
$timediff=$test;
$oneMinute=60; 
$oneHour=60*60; 
$oneDay=60*60*24; 
$dayfield=floor($timediff/$oneDay); 
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour); 
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute); 
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute)); 

$sDaysLeft=$dayfield; 
$sDaysText = "дней"; 
$nDaysLeftLength =strlen($sDaysLeft); 
$d_1=substr($sDaysLeft,-1,1); 

if (substr($sDaysLeft,-2,1) != 1 && $nDaysLeftLength>1) 
{ 
if ($d_1 == 2 || $d_1== 3 || $d_1== 4) 
{ 
$sDaysText = "дня"; 
} 
elseif ($d_1== 1) 
{ 
$sDaysText = "день"; 
} 
} 
if ($nDaysLeftLength==1) 
{ 
if ($d_1==2 || $d_1== 3 || $d_1== 4) 
{ 
$sDaysText = "дня"; 
} 
elseif ($d_1== 1) 
{ 
$sDaysText = "день"; 
} 
} 

$sHoursLeft=$hourfield; 
$sHoursText = "часов"; 
$nHoursLeftLength = strlen($sHoursLeft); 
$h_1=substr($sHoursLeft,-1,1); 
if (substr($sHoursLeft,-2,1) != 1 && $nHoursLeftLength>1) 
{ 
if ($h_1== 2 || $h_1== 3 || $h_1== 4) 
{ 
$sHoursText = "часа"; 
} 
elseif ($h_1== 1) 
{ 
$sHoursText = "час"; 
} 
} 

if ($nHoursLeftLength==1) 
{ 
if ($h_1== 2 || $h_1== 3 || $h_1== 4) 
{ 
$sHoursText = "часа"; 
} 
elseif ($h_1== 1) 
{ 
$sHoursText = "час"; 
} 
} 

$sMinsLeft =$minutefield; 
$sMinsText = "минут"; 
$nMinsLeftLength = strlen($sMinsLeft); 
$m_1=substr($sMinsLeft,-1,1); 

if ($nMinsLeftLength>1 && substr($sMinsLeft,-2,1) != 1) 
{ 
if ($m_1== 2 || $m_1== 3 || $m_1== 4) 
{ 
$sMinsText = "минуты"; 
} 
else if ($m_1== 1) 
{ 
$sMinsText = "минута"; 
} 
} 

if ($nMinsLeftLength==1) 
{ 
if ($m_1== 2 || $m_1==3 || $m_1== 4) 
{ 
$sMinsText = "минуты"; 
} 
elseif ($m_1== "1") 
{ 
$sMinsText = "минута"; 
} 
} 

$sSecsLeft = $secondfield; 
$sSecsText = "секунд"; 
$s_1=substr($sSecsLeft,-1,1); 
$nSecsLeftLength = strlen($sSecsLeft); 
if (substr($sSecsLeft,-2,1)!= 1 && $nSecsLeftLength>1) 
{ 
if ($s_1== 2 || $s_1== 3 || $s_1== 4) 
{ 
$sSecsText = "секунды"; 
} 
elseif ($s_1== 1) 
{ 
$sSecsText = "секунда"; 
} 
} 

if ($nSecsLeftLength==1) 
{ 
if ($s_1== 2 || $s_1== 3 || $s_1== 4) 
{ 
$sSecsText = "секунды"; 
} 
elseif ($sSecsLeft== "1") 
{ 
$sSecsText = "секунда"; 
} 
} 
if($sDaysLeft==0)$sDaysLeft='';
if($sDaysLeft==0)$sDaysText='';
if($sHoursLeft==0)$sHoursLeft='';
if($sHoursLeft==0)$sHoursText='';
if($sMinsLeft==0)$sMinsLeft='';
if($sMinsLeft==0)$sMinsText='';
$displaystring="".$sDaysLeft." ".$sDaysText." ".$sHoursLeft." ". 
$sHoursText." ". 
$sMinsLeft." ". 
$sMinsText." ". 
$sSecsLeft." ". 
$sSecsText; 

if ($timediff<0) $displaystring=''; 
#########
if($timediff>0)$ss=' ';
if($timediff<0)$ss='';
////////////////////////////////////////////////////////////////////////////////
echo "<u>Наказание закончится через:</u> <b>$ss $displaystring</b><br />\n";
}
if ($user['id']!=$ank['id']){
if (user_access('user_ban_set') || user_access('user_ban_set_h') || user_access('user_ban_unset'))
echo "<a href='/adm_panel/ban.php?id=$ank[id]'>Разбанить</a><br />\n";
echo "</div>\n";
}}}else{

if (isset($user) && $user['id']!=$ank['id'])
{
mysql_query("UPDATE `user` SET `prosm` = '".($ank['prosm']+1)."' WHERE `id` = '$ank[id]' LIMIT 1");
}
#####
if (isset($_GET['rating']) && isset($user)  && $user['id']!=$ank['id'] && $user['balls']>=50 && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$user[id]'"),0)>=0)
{
$my_r=intval(@mysql_result(mysql_query("SELECT `rating` FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]'"),0));
if ($my_r>'0'){
msg('Вы уже голосовали');
}else{
$new_r=min(max(@intval($_GET['rating']),1),15);
mysql_query("DELETE FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]' LIMIT 1");
if ($new_r)
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('$new_r','$user[id]','$ank[id]')");
$ank['rating']=intval(mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"),0));
mysql_query("UPDATE `user` SET `rating` = '$ank[rating]' WHERE `id` = '$ank[id]' LIMIT 1");
if ($new_r==1)
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/info.php?id=$user[id]]$user[nick][/url] Проголосовал(а)! Оценка +1', '$time')");
if ($new_r==2)
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/info.php?id=$user[id]]$user[nick][/url] Проголосовал(а)! Оценка +2', '$time')");
if ($new_r==3)
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/info.php?id=$user[id]]$user[nick][/url] Проголосовал(а)! Оценка +3', '$time')");
if ($new_r==4)
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/info.php?id=$user[id]]$user[nick][/url] Проголосовал(а)! Оценка +4', '$time')");
if ($new_r==5)
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/info.php?id=$user[id]]$user[nick][/url] Проголосовал(а)! Оценка +5', '$time')");

if ($new_r==15)
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/info.php?id=$user[id]]$user[nick][/url] Проголосовал(а)! Оценка +15', '$time')");

msg('Ваше мнение о пользователе успешно изменено');
}}
#####
?>
<div class='fyt'>
<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &raquo <?echo $ank['nick'];?>
</div>
<?
################################################################################
if ((!isset($_SESSION['refer']) || $_SESSION['refer']==NULL)
&& isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL &&
!preg_match('#info\.php#',$_SERVER['HTTP_REFERER']))
$_SESSION['refer']=str_replace('&','&amp;',preg_replace('#^http://[^/]*/#','/', $_SERVER['HTTP_REFERER']));
################################################################################
echo "<div class='$div'>\n";
echo "".status($ank['id'])."\n";
echo "<span style='color:$ank[ncolor]'>$ank[nick]</span>\n";
echo " ".wap_web($ank['id'])." ";
if($ank['balls']>=10000 && $ank['balls']<=24900){echo "<img src='style/bron.png'>\n";}
if($ank['balls']>=25000 && $ank['balls']<=49900){echo "<img src='style/silver.png'>\n";}
if($ank['balls']>=50000 && $ank['balls']<=100000000000000000){echo "<img src='style/zol.png'>\n";}
if($ank['balls']>=1000000)echo " <img src='/style/korona123.png' alt='' class='icon'</a>";
echo "".medal($ank['id'])."\n".vip($ank['id'])."<br />\n";
echo "</div>\n";
################################################################################
echo "<div class='wwe'>";
echo "".avatar($ank['id'])."\n";

echo '<span style="float : right;">';

if (isset($user) && $user['id']==$ank['id'])
{
if($ank['ves_statys']=='')
{
echo'<a href="/ves_statys.php"><img src="/style/vstatys/0.png"></a>';
}
else
{
echo '<a href="/ves_statys.php">'.$ank['ves_statys'].'</a>';
}
}
if (isset($user) && $user['id']!=$ank['id'])
{
if($ank['ves_statys']=='')
{
echo'<img src="/style/vstatys/0.png">';
}
else
{
echo ''.$ank['ves_statys'].'</p>';
}
}
echo '</span>';
echo "</div>";
########
echo "<div class='str'>";
if(isset($user) && $user['id']==$ank['id']){
}
if (is_file(H."/sys/avatar/$ank[id].gif") || is_file(H."/sys/avatar/$ank[id].jpg") || is_file(H."/sys/avatar/$ank[id].png")){
echo "<img src='/images/ava_comm.png'> <a href='/anketa/ava/?id=$ank[id]'>Комм</a> [$avkom]\n";
########
if ($user['id']!=$ank['id'] && mysql_query("SELECT SUM(`lail`) FROM `ava_laik` WHERE `id_kont` != '$user[id]'")>=0)
{
$my_r2=intval(@mysql_result(mysql_query("SELECT `laik` FROM `ava_laik` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]'"),0));
if ($my_r2>'0'){
if ($my_r2==1)
echo " | <a href='/anketa/ava/kto.php?id=$ank[id]'><img src='/images/klass.png'> Like</a> [$avlike]\n";
}else{
echo " | <a href='/anketa/ava/laik.php?id=$ank[id]&amp;laik=1'><img src='/images/klass.png'> Like</a> [$avlike] +1 голос\n";
}
}
if (isset($user) && $user['id']==$ank['id'])echo " | <a href='/anketa/ava/kto.php?id=$ank[id]'><img src='/images/klass.png'> Like</a> [$avlike]";
}
echo "</div></div>\n";
########



if(isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `clan_user` WHERE `id_user` = '".intval($ank['id'])."'"),0))
{
$klan_us=mysql_fetch_array(mysql_query("select * from `clan_user` where `id_user`='".intval($ank['id'])."'"));
$klan=mysql_fetch_array(mysql_query("select * from `clan` where `id`='".intval($klan_us['id_clan'])."'"));
echo "<div class='str'><img src='/style/icons/klan.gif' alt='' class='icon'/> Состоит в клане: <b><a href='/klan/klan.php?id=$klan[id]'>".htmlspecialchars($klan['name'])."</b></a></div>";
}

#########################




if ($ank['id']==$user['id']){
echo "<div class='vip'>";
echo " <a href='/avatar.php'>- Аватара</a> ";
echo " | <a href='/foto/$ank[id]/'> C Альбома</a><br /> ";
echo " <a href=\"/settings.php\">- Настройки</a> ";
echo " | <a href='/anketa.php/'> Профиль</a><br />";
echo " <a href=\"/pages/servis.php\">- VIP-услуги</a> | <a href=\"/umenu.php\">Кабинет</a>\n";
echo "</div>";
}
}

include_once 'garem/info.php'; 


if (isset($user)  && $user['id']!=$ank['id'] && $user['balls']>=50 && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` != '$user[id]'"),0)>=0)
{
$my_r=intval(@mysql_result(mysql_query("SELECT `rating` FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]'"),0));
echo "\n";
if ($my_r>'0'){
if ($my_r==1)
echo "";
if ($my_r==2)
echo "";
if ($my_r==3)
echo "";
if ($my_r==4)
echo "";
if ($my_r==5)
echo "";
}else{

echo "<div style='text-align: right;'><a href='/info.php?id=$ank[id]&amp;rating=1' title='+1'><img src='style/images/rating/1.png'></a>\n";
echo "|\n";
echo "<a href='/info.php?id=$ank[id]&amp;rating=2' title='+2'><img src='style/images/rating/2.png'></a>\n";
echo "|\n";
echo "<a href='/info.php?id=$ank[id]&amp;rating=3' title='+3'><img src='style/images/rating/3.png'></a>\n";
echo "|\n";
echo "<a href='/info.php?id=$ank[id]&amp;rating=4' title='+4'><img src='style/images/rating/4.png'></a>\n";
echo "|\n";
echo "<a href='/info.php?id=$ank[id]&amp;rating=5' title='+5'><img src='style/images/rating/5.png'></a>";

echo "|<a href='/info.php?id=$ank[id]&amp;rating=15' title='+15'><img src='style/images/rating/50.png'></a></div>\n";
}
}





////////////////////////////////////////////////////////////////////////////////
if (isset($user) && $user['id']!=$ank['id']){
echo "<div class='enk'>\n";
}
if (isset($user) && $user['id']!=$ank['id']){
echo "<img src='style/images/pochta.gif'> <a href='/mail.php?id=$ank[id]'>Написать сообщение</a><br />\n";
echo "<img src='/img/aut.png'> <a href='/present/present.php?user=$ank[id]'>Сделать Подарок</a><br />\n";

#-----------------------------------------------------------
$clan1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `clan_user` WHERE `id_user` = '".intval($user['id'])."'"),0);
$clan12 = mysql_result(mysql_query("SELECT COUNT(*) FROM `clan_user` WHERE `id_user` = '".intval($ank['id'])."'"),0);
if(isset($user) && !$clan1 || !$clan12)
{
echo "<img src='/style/icons/klan.gif' alt='' class='icon'/> <a href='info.php?id=$ank[id]&clan'>Пригласить в клан</a><br />";
}
#----------------------------------------------------------

echo "<img src=/ikonki/money.png alt='money.png'><a href='give_almaz.php?id=".$ank['id']."'>Перевести алмазы<a/><br/>\n";

if (isset($user) && $user['id']!=$ank['id']){if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kumir` WHERE `user` = '$user[id]' AND `kum` = '$ank[id]'"), 0)==0){echo "<img src='/img/kumr.gif' alt='' class='icon'/>\n";
echo'<a href="/fanes/act_user.php?id='.$ank['id'].'">Добавить в Кумиры</a><br/>';}}


if (isset($user) && $user['id']!=$ank['id']) echo "<img src='/img/make.png' alt='' class='icon'/> <a href='/dei/index.php?id=$ank[id]'><b>Выполнить действие</b></a> <br>\n";

if(isset($user) &&$user['id']!=$ank['id']&&$ank['sivor_zapret']!=1)echo "<img src='/sivor/img/sivor.png' alt='!'> <a href='/sivor/vopros_user.php?id=$ank[id]'>Отвечать в сыворотке</a><br />";
echo "<img src='style/korona123.png'> <a href='give_balls.php?id=".$ank['id']."'>Перевести балы</a><br />\n";
echo "<img src='style/images/duels.png' alt='' class='icon'/><a href='/duels.php?act=inser&id=$ank[id]'> Вызвать на Дуэль</a><br/>\n";
echo "<img src='/nagrady/gold.png' alt=''/> <a href=/nagrady/act_n.php?id=$ank[id]>В Доску Почета</a><br />";
}
$d2sqls=mysql_query("SELECT COUNT(*) FROM `blacklist` WHERE (`user` = '$user[id]' AND `lol` = '$ank[id]') LIMIT 1");
if (isset($user) && $user['id']!=$ank['id'] && mysql_result($d2sqls,0)==0)
echo "<img src='style/images/feud.png'> <a href='blacklist_add.php?id=$ank[id]'> В Черный Список</a><br />\n";

$d1sql = mysql_query("SELECT COUNT(*) FROM `frends_new` WHERE (`user` = '$user[id]' AND `to` = '$ank[id]') OR (`user` = '$ank[id]' AND `to` = '$user[id]') LIMIT 1");
$d2sql = mysql_query("SELECT COUNT(*) FROM `frends` WHERE (`user` = '$ank[id]' AND `frend` = '$user[id]') OR (`user` = '$user[id]' AND `frend` = '$ank[id]') LIMIT 1");
if (isset($user) && $user['id']!=$ank['id'] && mysql_result($d1sql, 0)==0 && mysql_result($d2sql,0)==0) 
{
if (isset($user) && $user['id']!=$ank['id']) 
echo "<img src='style/images/friendship.gif'> <a href='/frend_add.php?id=$ank[id]'>Предложить дружбу</a><br />\n";
}else{
//if (isset($user) && $user['id']!=$ank['id']) 
//echo "[<span class='new'>x</span>] <a href='frend_new.php?no=$ank[id]'>Удалить из друзей</a><br />\n";
}
if (isset($user) && $user['id']!=$ank['id']) echo "</div>\n";
////////////////////////////////////////////////////////////////////////////////








echo "<div class='$div'>\n";
echo "<img src='style/images/Profile.gif'> <a href='/ank.php?id=$ank[id]'>Анкета</a>\n";
echo " | <a href='/pages/aktiv.php?id=$ank[id]'>ИнфоАктив</a>";
if (isset($user) && $user['id']==$ank['id'])
echo " [<a href='/anketa.php'>Ред</a>]";
echo "</div>\n";
################################################################################
echo "<div class='$div'>\n";
$video = mysql_num_rows( mysql_query( "SELECT `id` FROM `video_user` WHERE `id_user` = '$ank[id]'" ) );
echo "<img src='xhata/glav/video16.png' alt='' class='icon'/> \n";
echo "<a href='/video/user.album.php?id=$ank[id]/'><u>Видеоальбомы</u></a> [<span class='cnt'>$video</span>]\n";
echo "</div>\n";

echo "<div class='$div'>\n";
$audio = mysql_num_rows( mysql_query( "SELECT `id` FROM `audio_user` WHERE `id_user` = '$ank[id]'" ) );
echo "<img src='xhata/glav/file_mp3.gif' alt='' class='icon'/> \n";
echo "<a href='/audio/user.album.php?id=$ank[id]/'><u>Аудиоальбомы</u></a> [<span class='cnt'>$audio</span>]\n";
echo "</div>\n";

echo "<div class='$div'>\n";
$foto = mysql_num_rows( mysql_query( "SELECT `id` FROM `gallery` WHERE `id_user` = '$ank[id]'" ) );
echo "<img src='style/images/PhotoIcon.gif' alt='' class='icon'/> \n";
echo "<a href='/foto/$ank[id]/'><u>Фотоальбомы</u></a> [<span class='cnt'>$foto</span>]\n";
echo "</div>\n";
echo "<div class='$div'>\n";
echo "<img src='style/images/film.gif' alt='' /> <a href='/obmen/files.php?id=$ank[id]'> Файлы</a> \n";
echo "[<span class='cnt'>" . mysql_result( mysql_query( "SELECT COUNT(*) FROM `obmennik_files` WHERE `id_user` = '$ank[id]'"), 0 ) . "</span>]\n";
echo "</div>\n";
################################################################################



echo "<div class='$div'>\n";//// меняем див на свой
echo "<img src='/img/100.png' alt='' class='icon'/>  <a href=\"rank/index.php?id=$ank[id]\" title=\"Все\">Награды: <font color='red'>$ank[nick] </font></a>\n";
echo "</div>";






echo "<div class='$div'>\n";
$us=mysql_result(mysql_query("SELECT COUNT(*) FROM `kumir` WHERE `user` = '$ank[id]'"),0);  $us2=mysql_result(mysql_query("SELECT COUNT(*) FROM `kumir` WHERE `kum` = '$ank[id]'"),0);  echo "<img src='img/fanes.png' alt='' /> <a href=/fanes/?id=$ank[id]>Кумиры</a>[$us/<font color=green>$us2</font>]<br />\n";
echo "</div>";


echo "<div class='$div'>\n";
echo "<img src='/img/make.png' alt='' class='icon'/> <a href='/dei/index.php?id=$ank[id]'>Действия";
echo "</a>\n";
include_once 'dei/count.php';
echo "</div>\n";

#-----------------------------------------------------------------#
echo "<div class='$div'>\n";

echo "<img src='style/images/friends.gif' alt='' class='icon'/> \n";
$frend = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
echo '


<a href=\'anka/frend.php?id='.($ank['id']).'\'>Друзья</a>
[<font color=\'#FF0000\'>'.$frend.'</font>]
</div>';
#------------------------------------------------------------------#

echo "<div class='$div'>\n";
echo "<img src=\"/style/icons/heart.png\" alt=\"r\"/> <a href=\"/love_wall.php?id=".$ank['id']."\">Стена признаний</a> [".mysql_result(mysql_query("select count(`id`)  from `love_wall` where `ank_id`='".$ank['id']."';"),0)."]<br />\n";
echo "</div>\n";

echo "<div class='$div'>\n";
echo"<img src='style/images/sendgift.gif'> <a href='/present/presentlist.php?user=$ank[id]'> Подарки</a> [<span class='cnt'>".mysql_result(mysql_query("SELECT COUNT(*) FROM `present_give` WHERE `id_give` = '$ank[id]'"),0)."</span>]\n";
###
$present=mysql_result(mysql_query("SELECT COUNT(*) FROM `present_give` WHERE `id_give` = '$ank[id]' LIMIT 1"),0);
if ($present>4){
$q=mysql_query("SELECT * FROM `present_give` WHERE `id_give` = '$ank[id]' ORDER BY time DESC LIMIT 5");
while ($post = mysql_fetch_array($q))
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$post[id_user]'"),0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `present_list` WHERE `id` = '$post[id_p]'"),0))
{
$qp=mysql_query("SELECT * FROM `present_list` WHERE `id` = '$post[id_p]' LIMIT 1");
$p = mysql_fetch_array($qp);
echo"<img src='$p[url]' width='32' height='32' />";
}}}
###
echo "</div>\n";
echo "<div class='$div'>\n";
$blog=mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_list` WHERE `id_user` = '$ank[id]'"),0);
echo "<img src='style/images/diary.gif'>\n";
echo "<a href='/blog/user.php?id=$ank[id]'>Дневники</a> [<span class='cnt'>$blog</span>]\n";
echo "</div>\n";

echo "<div class='$div'>\n";
echo "<img src='xhata/glav/bookmarks.gif' alt='' class='icon'/> \n";
echo "<a href='/zakladki/'><u>Закладки</u></a> [<span class='cnt'> new</span>]\n";
echo "</div>\n";


echo "<div class='$div'>\n";
echo "<img src='style/images/foe.png' alt='' class='icon'/>\n";
$bl=mysql_result(mysql_query("SELECT COUNT(*) FROM `blacklist` WHERE `user` = '$ank[id]'"), 0);
echo "<a href='blacklist.php?id=$ank[id]'> Черный список</a> [<span class='cnt'>$bl</span>]";
$d2sqls=mysql_query("SELECT COUNT(*) FROM `blacklist` WHERE (`user` = '$user[id]' AND `lol` = '$ank[id]') LIMIT 1");
echo "</div>\n";


//---------------------------------------------------------//
echo "<div class='$div'>\n";
$mod_file=H.'mods/birja_pitomcev/info2.php';
if(is_file($mod_file))include $mod_file;
echo "</div>";
//------------------------------

##################
echo "<div class='gmenu'>\n";//// меняем див на свой
$q=mysql_query("SELECT * FROM `rank` WHERE `id_user` = '$ank[id]' LIMIT 4");

while ($post=mysql_fetch_array($sql))
{
$rank=mysql_fetch_array(mysql_query("SELECT * FROM `rank_list` WHERE `id` = '$post[id_rank]' LIMIT 1"));
echo "<img src='/rank/img_rank/$rank[id].png' alt='*' class='icon'/> ";
}

if(mysql_num_rows($sql)>=4)
echo "<a href='/rank/?id=$ank[id]'>&raquo;</a>";
echo "</div>\n";

########## Реётинг активности#################
@mysql_query("UPDATE `user` SET `akt_rating` = '".($user['akt_rating']+0.004)."' WHERE `id` = '$user[id]' LIMIT 1");
########## Реётинг активности#################
$timediff=mysql_result(mysql_query("SELECT `time` FROM `user` WHERE `id` = '$ank[id]' LIMIT 1",$db), 0);

$oneMinute=60; 
$oneHour=60*60; 
$hourfield=floor(($timediff)/$oneHour); 
$minutefield=floor(($timediff-$hourfield*$oneHour)/$oneMinute); 
$secondfield=floor(($timediff-$hourfield*$oneHour-$minutefield*$oneMinute)); 

$sHoursLeft=$hourfield; 
$sHoursText = "часов"; 
$nHoursLeftLength = strlen($sHoursLeft); 
$h_1=substr($sHoursLeft,-1,1); 
if (substr($sHoursLeft,-2,1) != 1 && $nHoursLeftLength>1) 
{ 
    if ($h_1== 2 || $h_1== 3 || $h_1== 4) 
    { 
        $sHoursText = "часа"; 
    } 
    elseif ($h_1== 1) 
    { 
        $sHoursText = "час"; 
    } 
} 

if ($nHoursLeftLength==1) 
{ 
    if ($h_1== 2 || $h_1== 3 || $h_1== 4) 
    { 
        $sHoursText = "часа"; 
    } 
    elseif ($h_1== 1) 
    { 
        $sHoursText = "час"; 
    } 
} 

$sMinsLeft =$minutefield; 
$sMinsText = "минут"; 
$nMinsLeftLength = strlen($sMinsLeft); 
$m_1=substr($sMinsLeft,-1,1); 

if ($nMinsLeftLength>1 && substr($sMinsLeft,-2,1) != 1) 
{ 
    if ($m_1== 2 || $m_1== 3 || $m_1== 4) 
    { 
        $sMinsText = "минуты"; 
    } 
    else if ($m_1== 1) 
    { 
        $sMinsText = "минута"; 
    } 
} 

if ($nMinsLeftLength==1) 
{ 
    if ($m_1== 2 || $m_1==3 || $m_1== 4) 
    { 
        $sMinsText = "минуты"; 
    } 
    elseif ($m_1== "1") 
    { 
        $sMinsText = "минута"; 
    } 
} 


$displaystring="". 
$sHoursLeft." ". 
$sHoursText." ". 
$sMinsLeft." ". 
$sMinsText." ";


if ($timediff<0) $displaystring='дата уже наступила'; 
##########
echo "<div class='aut'>";


echo "<img src='style/images/medal_green.png' alt='' class='icon'/> <span class=\"ank_n\">Рубины: </span><span class='cnt'>$ank[rubin]</span><br />\n";


echo "<img src='style/images/rating.gif'> <a href='/users.php?sort=rating'>Рейтинг:</a> <span class='cnt'>$ank[rating]</span><br />\n";

echo "<img src='style/images/many1.gif'> <a href='/users.php?sort=balls'>Баллы:</a> <span class='cnt'>$ank[balls]</span>\n";
echo "| <img src='style/images/um.png'> IQ: <span class='cnt'>".$ank["iq"]."</span><br />\n";

if ($ank['akt_rating']!=NULL){
echo "<img src='style/images/medal_green.png' alt='' class='icon'/> <span class=\"ank_n\">Рейтинг активности: </span><span class='cnt'>$ank[akt_rating]</span><br />\n";
}else{
echo "<img src='style/images/medal_green.png' alt='' class='icon'/> <span class=\"ank_n\">Рейтинг активности: </span><b>0</b><br />";
}
$kule1=mysql_result(mysql_query("SELECT COUNT(*) FROM `duels` WHERE `idur` = '$ank[id]' AND `kolur` > `koler` AND `act` = '2'"),0);
$kule2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duels` WHERE `ider` = '$ank[id]' AND `koler` > `kolur` AND `act` = '2'"),0);
$obshij = ($kule1+$kule2);
echo "• Выигранных дуэлей: <b>$obshij</b><br />\n";
$kuleq1=mysql_result(mysql_query("SELECT COUNT(*) FROM `duels` WHERE `idur` = '$ank[id]' AND `kolur` < `koler` AND `act` = '2'"),0);
$kuleq2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duels` WHERE `ider` = '$ank[id]' AND `koler` < `kolur` AND `act` = '2'"),0);
$obshijq = ($kuleq1+$kuleq2);
echo "• Проигранных дуэлей: <b>$obshijq</b><br />\n";
echo "• Переходов по сайту: <b>$ank[perehodu]</b><br />\n";
echo "• На сайте провел: <u>$displaystring</u><br />\n";
echo "• Просмотрено: <u>$ank[prosm] раз(а)</u><br />";
echo "• Посл. посещение: ".vremja($ank['date_last'])."<br />\n";
echo "• Регистрация: ".vremja($ank['date_reg'])."<br />\n";
echo "</div>";
################################################################################
if ($user['level']>$ank['level']){
echo "<div class='glavnaya2'>\n";
if ($ank['ip']!=NULL){
if (user_access('user_show_ip') && $ank['ip']!=0){
echo "• <u>IP:</u> ".long2ip($ank['ip'])."";
if (user_access('adm_ban_ip'))
echo " [<a href='/adm_panel/ban_ip.php?min=$ank[ip]'>Бан</a>]";
echo "<br />\n";
}
}



if ($ank['ip_cl']!=NULL){
if (user_access('user_show_ip') && $ank['ip_cl']!=0){
echo "• <u>IP (CLIENT):</u> ".long2ip($ank['ip_cl'])."";
if (user_access('adm_ban_ip'))
echo " [<a href='/adm_panel/ban_ip.php?min=$ank[ip_cl]'>Бан</a>]";
echo "<br />\n";
}
}

if ($ank['ip_xff']!=NULL){
if (user_access('user_show_ip') && $ank['ip_xff']!=0){
echo "• <u>IP (XFF):</u> ".long2ip($ank['ip_xff'])."";
if (user_access('adm_ban_ip'))
echo " [<a href='/adm_panel/ban_ip.php?min=$ank[ip_xff]'>Бан</a>]";
echo "<br />\n";
}}
################################################################################
if (user_access('user_show_ua') && $ank['ua']!=NULL)
echo "• <u>UA:</u> $ank[ua]<br />\n";
if (user_access('user_show_ip') && opsos($ank['ip']))
echo "• <u>Пров:</u> ".opsos($ank['ip'])."<br />\n";
if (user_access('user_show_ip') && opsos($ank['ip_cl']))
echo "• <u>Пров (CL):</u> ".opsos($ank['ip_cl'])."<br />\n";
if (user_access('user_show_ip') && opsos($ank['ip_xff']))
echo "• <u>Пров (XFF):</u> ".opsos($ank['ip_xff'])."<br />\n";
}
################################################################################
if($user['level']>=4)
{
echo"<a href=/stock/admin.php?id=$ank[id]>Назначить модером акций</a><br/>";
}
if ($user['level']>$ank['level']){
if (user_access('user_prof_edit'))
echo "• <a href='/adm_panel/user.php?id=$ank[id]'>Редактировать профиль</a><br />\n";
if ($user['id']!=$ank['id']){
if (user_access('user_ban_set') || user_access('user_ban_set_h') || user_access('user_ban_unset'))
echo "• <a href='/adm_panel/ban.php?id=$ank[id]'>Нарушения [BAN]</a><br />\n";
}
if (user_access('adm_log_read') && $ank['level']!=0 && ($ank['id']==$user['id'] || $ank['level']<$user['level']))
echo "• <a href='/adm_panel/adm_log.php?id=$ank[id]'>Отчет по администрированию</a><br />\n";
echo "</div>\n";
}
?>
<div class='fyt'>
<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &raquo <?echo $ank['nick'];?>
</div>
<?
include_once 'sys/inc/tfoot.php';
?>