<?
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';

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


if ((!isset($_SESSION['refer']) || $_SESSION['refer']==NULL)
&& isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL &&
!ereg('info\.php',$_SERVER['HTTP_REFERER']))
$_SESSION['refer']=str_replace('&','&amp;',ereg_replace('^http://[^/]*/','/', $_SERVER['HTTP_REFERER']));

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),5);
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')");



msg('Ваше мнение о пользователе успешно изменено');
}}


aut();
/////////////////////////////////////
$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 "Вы не можете просматривать страницу обитателя <b>$ank[nick]</b>  Вы добавлены в его черный список  <br/>";include_once 'sys/inc/tfoot.php';
exit;
}
////////////////////////////////////
if (isset($user) && $user['id']!=$ank['id'])
{mysql_query("UPDATE `user` SET `prosm` = '".($ank['prosm']+1)."' WHERE `id` = '$ank[id]' LIMIT 1");}
if (isset($user) && $user['id']!=$ank['id'])
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guest` WHERE `id_user` = '$ank[id]' AND `id_guest` = '$user[id]'"), 0)==0)
{
mysql_query("INSERT INTO `my_guest` (`id_user`, `id_guest`, `time`) values('$ank[id]', '$user[id]', '$time')",$db);
}
mysql_query("UPDATE `my_guest` SET `time` = '$time' WHERE `id_user` = '$ank[id]' AND `id_guest` = '$user[id]'");
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time'"), 0)!=0)
{
$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 "Обитатель был забанен за нарушение условий использования сервиса<br/>\n";
echo "Забанен до: ".vremja($post['time'])."<br>\n";
echo "Причина: ".$post['prich']."<br />\n";
if (isset($user) && ($user['level']>$ank['level'] || $user['level']==4))
{

echo '- <a href="/adm_panel/ban.php?id='.$ank['id'].'">РАЗБАН</a><br>';
}
}
}

$narush=mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]'"), 0);
echo "<span class='ank_n'>Нарушений:</span>".(($narush==0)?" <span class='ank_d'>нет</span><br />\n":" <span class=\"ank_d\">$narush</span><br />\n");


echo''.online($ank['id']).' '.$ank['nick'].'';

///////////////////////////////////////////////////
if($ank['rating']>=0 && $ank['rating']<=2)echo " <img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=3 && $ank['rating']<=5)echo " <img src='/zv/marine.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=6 && $ank['rating']<=8)echo " <img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=9 && $ank['rating']<=11)echo " <img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=12 && $ank['rating']<=14)echo " <img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/grey.gif'></img><br />";

if($ank['rating']>=15 && $ank['rating']<=19)echo " <img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/marine.gif'><img src='/zv/marine.gif'></img><br />";
if($ank['rating']>=20 && $ank['rating']<=24)echo " <img src='/zv/yellow.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=25 && $ank['rating']<=29)echo " <img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=30 && $ank['rating']<=34)echo " <img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=35 && $ank['rating']<=39)echo " <img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/grey.gif'></img><br />";

if($ank['rating']>=40 && $ank['rating']<=46)echo " <img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/yellow.gif'><img src='/zv/yellow.gif'></img><br />";
if($ank['rating']>=47 && $ank['rating']<=53)echo " <img src='/zv/green.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=54 && $ank['rating']<=60)echo " <img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=61 && $ank['rating']<=67)echo " <img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=68 && $ank['rating']<=74)echo " <img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/grey.gif'></img><br />";

if($ank['rating']>=75 && $ank['rating']<=84)echo " <img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/green.gif'><img src='/zv/green.gif'></img><br />";
if($ank['rating']>=85 && $ank['rating']<=94)echo " <img src='/zv/red.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=95 && $ank['rating']<=104)echo " <img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=105 && $ank['rating']<=114)echo " <img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=115 && $ank['rating']<=124)echo " <img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/grey.gif'></img><br />";

if($ank['rating']>=125 && $ank['rating']<=139)echo " <img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/red.gif'><img src='/zv/red.gif'></img><br />";
if($ank['rating']>=140 && $ank['rating']<=154)echo " <img src='/zv/4.jpg'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=155 && $ank['rating']<=169)echo " <img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=170 && $ank['rating']<=184)echo " <img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=185 && $ank['rating']<=199)echo " <img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/grey.gif'></img><br />";

if($ank['rating']>=200 && $ank['rating']<=219)echo " <img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/4.jpg'><img src='/zv/4.jpg'></img><br />";
if($ank['rating']>=220 && $ank['rating']<=239)echo " <img src='/zv/7.jpg'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=240 && $ank['rating']<=259)echo " <img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/grey.gif'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=260 && $ank['rating']<=279)echo " <img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/grey.gif'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=280 && $ank['rating']<=299)echo " <img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/grey.gif'></img><br />";
if($ank['rating']>=300 && $ank['rating']<=2999999999)echo " <img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/7.jpg'><img src='/zv/7.jpg'></img><br />";
///////////////////////////////////////////////////

///////////////////////////////////////////////////////
if ($ank['balls']>0 && $ank['balls']<=500) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:green'>новенький</span></b><br />\n";}
if ($ank['balls']>501 && $ank['balls']<=1500) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:blue'>освоившийся</span></b><br />\n";}
if ($ank['balls']>1501 && $ank['balls']<=2000) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:darkred'>житель</span></b><br />\n";}
if ($ank['balls']>2001 && $ank['balls']<=3500) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:magenta'>местный</span></b><br />\n";}
if ($ank['balls']>3501 && $ank['balls']<=4000) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:red'>гражданин</span></b><br />\n";}
if ($ank['balls']>4001 && $ank['balls']<=5000) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:teal'>свой чел</span></b><br />\n";}
if ($ank['balls']>5001 && $ank['balls']<=6500) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:orangered'>почетный чел</span></b><br />\n";}
if ($ank['balls']>6501 && $ank['balls']<=8000) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:indigo'>дружбан сайта</b></span><br />\n";}
if ($ank['balls']>8001 && $ank['balls']<=9000) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b><span style='color:blue'>г</span><span style='color:red'>о</span><span style='color:blue'>р</span><span style='color:red'>д</span><span style='color:blue'>о</span><span style='color:darkred'>с</span><span style='color:red'>т</span><span style='color:blue'>ь</span> <span style='color:red'>С</span><span style='color:blue'>а</span><span style='color:red'>й</span><span style='color:blue'>т</span><span style='color:red'>a</span></b><br />\n";}
if ($ank['balls']>9001 && $ank['balls']<=900099999999999) {echo "<img src='/ic_m3.gif' alt='' /> Ранг: <b> <span style='color:blue'>ОДИН</span> <span style='color:orangered'>ИЗ</span> <span style='color:green'>ОСНОВАТЕЛЕЙ</span></b><br />\n";}
//////////////////////////////////////////////////////// 
 echo "<img src='/ic_ch7.gif' alt='' /> ";
if (isset($user) && $user['id']==$ank['id'])echo "<a href='/privet.php'>\n";
if ($ank['prcolor']!=NULL){
echo '<font color="#'.$ank[prcolor].'">';}
if ($ank['privet']!=NULL)echo esc(trim(br(bbcode(smiles(stripcslashes(htmlspecialchars($ank['privet'])))))))."\n";
else
echo "Всем привет";
if (isset($user) && $user['id']==$ank['id'])echo "</a><img src=\"/pen.gif\" alt=\"\"/>\n";
echo "<br />";
/////////////////////////////////////////////////////
if(is_file("sys/avatar/$ank[id].gif")){
echo "<img src='/sys/avatar/$ank[id].gif'><br />\n";
}else if(is_file("sys/avatar/$ank[id].jpg")){
echo "<img src='/sys/avatar/$ank[id].jpg'><br />\n";
}else if(is_file("sys/avatar/$ank[id].png")){
echo "<img src='/sys/avatar/$ank[id].png'><br />\n";
}else{
echo '<img src="/sys/avatar/0.png"><br />';}
//////////////////////////////////////////////////////
if (isset($user) && $user['id']==$ank['id'])


{

echo '<img src="/static.php?p='.$ank['rating'].'" alt="'.$ank['rating'].'" />';
echo '<br/>';
}
if (isset($user) && $user['id']!=$ank['id']){
echo '<img src="/static.php?p='.$ank['rating'].'" alt="'.$ank['rating'].'" />';
echo '<br/>';}
if(isset($user) && $user['id']==$ank['id']){
	echo '<img src="/images/settings.gif" alt="" class="icon"/> <a href="/avatar.php">Настройки аватара</a><br />';
	}

echo "<img src='/style/themes/$set[set_them]/user/$ank[pol].png' alt='' />";

if($ank['pol']==1){
	echo '<span class="ank_n"> Пол:</span>&nbsp;<span class="ank_d">Мужской</span><br />';
	}else{
		echo '<span class="ank_n">Пол:</span>&nbsp;<span class="ank_d">Женский</span><br />';
		}

$timediff=mysql_result(mysql_query("SELECT `time` FROM `user` WHERE `id` = '$ank[id]' LIMIT 1",$db), 0);

$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 = "секунда";
    }
}

$displaystring="".
$sDaysLeft." ".
$sDaysText." ".
$sHoursLeft." ".
$sHoursText." ".
$sMinsLeft." ".
$sMinsText." ".
$sSecsLeft." ".
$sSecsText;

if ($timediff<0) $displaystring='дата уже наступила';


$q=mysql_fetch_array(mysql_query("SELECT * FROM `city` WHERE `city_id`='$ank[mycity]' LIMIT 1"));
$stra=$q[country_id];
$regi=$q[region_id];
$qregi=mysql_fetch_array(mysql_query("SELECT * FROM `region` WHERE `region_id`='$regi' LIMIT 1"));
$qcoun=mysql_fetch_array(mysql_query("SELECT * FROM `country` WHERE `country_id`='$stra' LIMIT 1"));
if ($ank['mycity']!=0){
 echo "<img src='/images/Profile.gif' alt='' /> <span class=\"ank_n\">Страна:$qcoun[name]</span></a><br />";
echo "<img src='/images/Profile.gif' alt='' /> <span class=\"ank_n\">Регион:$qregi[name]</span><br />";
echo "<img src='/images/Profile.gif' alt='' /> <span class=\"ank_n\">Город:$q[name]</span><br />";}
else
echo "<img src='/images/Profile.gif' alt='' /> <span class=\"ank_n\">Город: не заполнено</span><br />";


  if(isset($user) && $user['id']==$ank['id']){
	echo '<img src="/images/settings.gif" alt="" class="icon"/> <a href="/countr.php">Настройкa города</a><br />';
	}








if (isset($user) && $user['id']==$ank['id'])


{


//echo'<img src="/sys/img/love.png" alt="" class="icon"/><a href="/city/health.php">Здоровье: <b>'.$ank['health'].'</b>%</a>';

echo'<img src="/images/dating.gif" alt="" class="icon"/> <a href="/city/stamina.php">Выносливость:</a> '.$ank['stamina'].'<br />';


echo'<img src="/images/dating.gif" alt="" class="icon"/> <a href="/city/privl.php">Привлекательность:</a> '.$ank['pr'].'<br />';


if($ank['home']==''){echo'<img src="/img/home.gif" alt="" class="icon"/> Твой дом: <a href="/city/rieltor.php">У вас нет дома!</a><br />';}
else
{echo'<img src="/img/home.gif" alt="" class="icon"/> Твой дом: <a href="/city/rieltor.php">'.$ank['home'].'</a><br />';}




}

if (isset($user) && $user['id']!=$ank['id'])

{



//echo'<img src="dating.gif" alt="" class="icon"/> Здоровье: <b>'.$ank['health'].'</b>%';

echo'<img src="/images/dating.gif" alt="" class="icon"/> Выносливость: '.$ank['stamina'].'<br />';


echo'<img src="/images/dating.gif" alt="" class="icon"/> Привлекательность: '.$ank['pr'].'<br />';


if($ank['home']==''){echo'<img src="/img/home.gif" alt="" class="icon"/> Дом: У вас нет дома!<br />';}
else
{echo'<img src="/img/home.gif" alt="" class="icon"/> Дом: '.$ank['home'].'<br />';}
}




if (isset($user) && $user['id']==$ank['id'])echo "<img src='/images/Info.gif' alt='' class='icon'/> <a class='icolink' href='/ank.php'>Анкета</a><br />\n";
else echo "<img src='/images/Info.gif' alt='' class='icon'/> <a class='icolink' href='/ank.php?id=$ank[id]'>Анкета</a><br />\n";




$k_fr = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
echo "<img src='images/friends.gif' alt='' class='icon'/>\n";
echo '<a href="/frend.php?id='.$ank['id'].'"> Друзья</a>&nbsp;('.$k_fr.'';$i =0;
$res = mysql_query("select `frend` from `frends` WHERE `user` = '$ank[id]' AND `i` = '1'");
while ($k_fr = mysql_fetch_array($res)){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$k_fr[frend]' && `date_last` > '".(time()-600)."'"),0) != 0) $i++;
}
echo "/<span class=\"ank_n\">$i</span>)<br />";






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


echo "<div class='rowup'>";


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

echo "</div>\n";
if (isset($ank) && $ank['id']==$user['id'])echo '<div class="row4"><img src="/images/privat.gif" alt="" class="icon"/> <a class="icolink" href="/mail.php">Моя почта</a>';

$knm=mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
if (isset($ank) && $ank['id']==$user['id'])if ($knm>0)echo " <span style='color: #b40000; font-size: small'>(+$knm)</span><br />";
echo '</div>';
echo"<img src=\"/images/sendgift.gif\" alt=\"\"/> <span class=\"ank_n\"><a href='/present/presentlist.php?user=$ank[id]'> Подарки</a></span> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `present_give` WHERE `id_give` = '$ank[id]'"),0).")<br />\n";


if (isset($user) && $user['id']!=$ank['id'])echo "<img src=\"/images/serv.gif\" alt=\"\"/> <a href='/present/present.php?user=$ank[id]'>Сделать подарок</a><br />";

if (isset($ank) && $ank['id']==$user['id'])echo '<img src="/images/settings.gif" alt="" class="icon"/> <a class="icolink" href="/settings.php">Настройки</a><br />';


/////////////////////////////
if(isset($user) && $user['id']!=$ank['id'])
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `id_ank` = '$ank[id]' AND `id_user`='$user[id]' LIMIT 1"),0)==0)
{
mysql_query("INSERT INTO `my_guests` (`id_ank`, `id_user`, `time`) VALUES ('$ank[id]', '$user[id]', '$time')");
}
else
{
$guest=mysql_fetch_array(mysql_query("SELECT * FROM `my_guests` WHERE `id_ank` = '$ank[id]' AND `id_user`='$user[id]' LIMIT 1"));
mysql_query("UPDATE `my_guests` SET `count` = '".($guest['count']+1)."', `time`='$time' WHERE `id` = '$guest[id]' LIMIT 1");
}
}
//////////////////////////////а это сами "гости (0)"
if (isset($user) && $user['id']==$ank['id'])echo "<img src=\"/images/readers.gif\" alt=\"\"/>";
if (isset($user) && $user['id']==$ank['id'])echo "<a href='/guests.php'> Мои читатели </a>\n";
if (isset($user) && $user['id']==$ank['id'])$new_g=mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `id_ank` = '$user[id]' AND `read`='1'"),0);
if($new_g!=0)echo "<a href='/guests.php'></a>(+$new_g)<br/>\n";
else 
if (isset($user) && $user['id']==$ank['id'])echo "</a>(0)<a/><br/>";
///////////////////////////////////////////////////////////////////////////

if (isset($user) && $user['id']==$ank['id'])echo "<img src='/images/journal3.gif' alt='' class='icon'/> <a href=\"/jurnal.php\" title=\"Журнал\">Журнал</a>\n";   if ($jn>0) echo "(+$jn)\n";   if (isset($user) && $user['id']==$ank['id'])echo "<br />\n";


$blog=mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_list` WHERE `id_user` = '$ank[id]'"),0);
echo '<img src="/images/diary.gif" </img>';
echo "<a href='/blog/user.php?id=$ank[id]'> Блоги</a> ($blog)<br />\n";

if (isset($user) && $user['id']!=$ank['id'])echo "<span class=\"ank_d\"><img src='/images/privat.gif' alt='d' /> <a href=\"/mail.php?id=$ank[id]\">Написать сообщение</a></span><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)
    {
   echo '<img src="/images/friendship.gif" alt="" class="icon"/> <a href="frend_add.php?id='.$ank['id'].'">Предложить дружбу</a><br />';
    }
    if (isset($user) && $user['id']!=$ank['id'] && mysql_result($d2sql, 0)==0)
{echo '<img src="/img/feud.png" alt="" class="icon"/> <a href="blacklist_add.php?id='.$ank['id'].'"> Записать в черный список</a><br />';
} 




echo "<img src=\"/images/rating.gif\" alt=\"r\"/> <a href=\"/users.php?sort=rating\">Рейтинг: </a> ";
echo "$ank[rating]<br />";
echo "<img src='/images/s.png' alt='' class='icon'/>\n";
echo "<a href='/users.php?sort=balls'>Баллы:</a> ";
echo "$ank[balls]<br />";



if (isset($user)  && $user['id']!=$ank['id'] && $user['balls']>=300 && 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 "<a href=\"/info.php?id=$ank[id]&amp;rating=1\" title=\"+1\">+1</a>";
echo "|\n";

echo "<a href=\"/info.php?id=$ank[id]&amp;rating=2\" title=\"+2\">+2</a>";

echo "|\n";


echo "<a href=\"/info.php?id=$ank[id]&amp;rating=3\" title=\"+3\">+3</a>";
echo "|\n";


echo "<a href=\"/info.php?id=$ank[id]&amp;rating=4\" title=\"+4\">+4</a>";
echo "|\n";


echo "<a href=\"/info.php?id=$ank[id]&amp;rating=5\" title=\"+5\">+5</a>";
}
echo "\n";
}


# ---------------------------------------------------------------------------------- Стена:

# SQL запросы в базу данных для создания нужных таблиц:
@mysql_query("CREATE TABLE IF NOT EXISTS `wall` (`id` INT( 6 ) NOT NULL AUTO_INCREMENT , `user_id` INT( 6 ) NOT NULL , `who` INT( 6 ) NOT NULL , `time` INT( 11 ) NOT NULL , `message` TEXT NOT NULL , PRIMARY KEY ( `id` ) , INDEX ( `user_id` ));");
@mysql_query("ALTER TABLE `user` ADD `msg_on_wall` INT( 6 ) DEFAULT '0' NOT NULL ;");

$user_id = $ank['id'];

if(!isset($_GET['wall']))
{
	echo '<div class="menu"><b><a href="info.php?id='.$user_id.'&amp;wall">[+] Стена</a></b></div>';
}
else
{
	echo '<div class="menu"><b><a href="info.php?id='.$user_id.'">[-] Стена</a></b></div>';

	# Удаление сообщений:
	if(isset($_GET['delete']) AND !empty($_GET['delete']))
	{
		$delete = (int)$_GET['delete'];

		if($user['level'] > 3 OR $ank['id'] == $user['id'])
		{
			$query = @mysql_query("SELECT `id` FROM `wall` WHERE `user_id` = '$user_id' AND `id` = '$delete';");

			if(@mysql_affected_rows() > 0)
			{
				@mysql_query("DELETE FROM `wall` WHERE `user_id` = '$user_id' AND `id` = '$delete' LIMIT 1;");

				echo '<div class="news">Сообщение успешно удалено!</div>';
			}
			else
				echo '<div class="news">Сообщение не найдено!</div>';
		}
		else
			echo '<div class="news">У Вас нет прав для удаления этого сообщения!</div>';
	}

	# Добавление сообщений:
	if(isset($_POST['message']) AND isset($user))
	{
		$message = $_POST['message'];

		if(isset($_POST['translit']) AND $_POST['translit']) $message = translit($message);

		$err = '';

		if(strlen2($message) > 512) $err .= '&nbsp;&nbsp;сообщение слишком длинное;<br/>';
		if(strlen2($message) < 2) $err .= '&nbsp;&nbsp;короткое сообщение;<br/>';
		if(@mysql_result(@mysql_query("SELECT COUNT(*) FROM `wall` WHERE `user_id` = '$user_id' AND `message` = '".@mysql_escape_string($message)."' AND `time` > '".($time - 300)."' LIMIT 1"), 0) != 0) $err .= '&nbsp;&nbsp;ваше сообщение повторяет предыдущее;<br/>';
		if(time() - @mysql_result(@mysql_query("SELECT `time` FROM `wall` WHERE `user_id` = '$user_id' ORDER BY `id` DESC LIMIT 1;"), 0) < 30) $err .= '&nbsp;&nbsp;не стоит писать сообщения так часто..<br/>';

		if($err != '')
		{
			echo '<div class="news">При добавление сообщения произошли следующие ошибки:<br/>'.$err.'</div>';
		}
		else
		{
			$message = @mysql_escape_string($message);

			@mysql_query("INSERT INTO `wall` (`user_id`, `who`, `time`, `message`) values('$user_id', '".$user['id']."', '".time()."', '$message')");
			@mysql_query("UPDATE `user` SET `msg_on_wall` = `msg_on_wall` + 1 WHERE `id` = '".$user['id']."' LIMIT 1");

			if($user['id']!=$user_id){
            $msg = 'на Вашей стене появилась новая запись';
            mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '".$user_id."', '".$msg."', '".$time."')");
}
			echo '<div class="news">Сообщение успешно добавлено!</div>';
		}
	}

	# Вывод сообщений:


	$k_post = @mysql_result(@mysql_query("SELECT COUNT(*) FROM `wall` WHERE `user_id` = '$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)
	{
		echo '<tr><td class="p_t">Нет сообщений...</td></tr>';
	}

	function getAvatar($id)
	{
		global $set;

		if(is_file(H."sys/avatar/$id.gif"))
			return "<img src='/sys/avatar/$id.gif' alt='' />\n";
		elseif (is_file(H."sys/avatar/$id.jpg"))
			return "<img src='/sys/avatar/$id.jpg' alt='' />\n";
		elseif (is_file(H."sys/avatar/$id.png"))
			return "<img src='/sys/avatar/$id.png' alt='' />\n";
		else
			return "<img src='/style/themes/$set[set_them]/user.png' alt='' />\n";
	}


	$query = @mysql_query("SELECT * FROM `wall` WHERE `user_id` = '$user_id' ORDER BY `time` DESC LIMIT $start, $set[p_str];");
	while ($array = mysql_fetch_array($query))
	{
		$user_nick = @mysql_result(@mysql_query("SELECT `nick` FROM `user` WHERE `id` = '".$array['who']."';"), 0);

		if($num==1){
echo "<div class='rowdown'>";
$num=0;
}else{
echo "<div class='rowup'>";
$num=1;}


	echo ''.online($array['who']).'';
		echo '<a href="info.php?id='.$array['who'].'">'.$user_nick.'</a> ('.vremja($array['time']).')<br />

					'.esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($array['message'])))))))).'<br />
		';

		if($user['level'] > 3 OR $ank['id'] == $user['id'])
		{
			echo '[<a href="info.php?id='.$user_id.'&amp;wall&amp;delete='.$array['id'].'">удалить</a>]<br /></div>';
		}


	}

	echo '</table>';

	if($k_page > 1) str('info.php?id='.$user_id.'&amp;wall&amp;'.rand(1000, 9999).'&amp;', $k_page, $page);

	echo '<div>';

	echo
	'
		<form method="post" action="info.php?id='.$user_id.'&amp;wall">
			Сообщение?<br/>
			<textarea name="message"></textarea><br/>
	';



	echo
	'
			<input type="submit" value="Написать на стене"/>
		</form>
	';

	echo '</div>';
	echo '</div>';

	echo '<div class="menu"><b><a href="info.php?id='.$user_id.'">[-] Стена</a></b></div>';

	echo '<!-- (C)oded by i0n1x -->';
}
# ---------------------------------------------------------------------------------- ;






echo "<div class='rowup'>";
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' AND `date_last` > '".(time()-600)."' LIMIT 1"),0)==1)
echo "<b>Сейчас на сайте</b><br />\n";
if ($ank['prosm']!=NULL){
echo "<span class=\"ank_n\">Страничка просмотрена:</span> $ank[prosm] раз(а)<br />";}else{echo "Страничка просмотрена: 0 раз(а)<br />";}
     echo "<span class=\"ank_n\">Время на сайте:</span> <span class=\"ank_d\">$displaystring</span><br />\n";
$perehodu=mysql_result(mysql_query("SELECT `perehodu` FROM `user` WHERE `id` = '$ank[id]' LIMIT 1",$db), 0);
echo "<span class=\"ank_n\">Переходов по сайту:</span> <span class=\"ank_d\">$perehodu</span><br />\n";
echo "<span class=\"ank_n\">Посл. посещение:</span> ".vremja($ank['date_last'])."<br />\n";
echo "<span class=\"ank_n\">Регистрация:</span> ".vremja($ank['date_reg'])."<br />\n";
echo "</div>\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";
}





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

<tr>

<td>

<h4>Дата <?=date("m-d-Y");?></h4>
</table>
