<?php
require_once $_SERVER['DOCUMENT_ROOT']."/includes/start.php";
if(isset($_SESSION['auth']) and $_SESSION['auth']==1){

if(eregi("[^0-9]" , $_GET['uid'])){
header ("Location: /enter.php?"); exit;
}


echo $_up;

echo '<div class="menu" style=" font-family: Georgia, Garamond, Verdana, Tahoma, Arial;

 font-size: 12 pt;">';
if(isset($_GET['uid'])){$uid=$_GET['uid'];}else{$uid='';}
$infuz=mysql_query("select * from users where id='$uid' limit 1");
if(mysql_num_rows($infuz)==0){
echo'Ошибка! Пользователь не найден!<br></div>'; exit;
}
$uzin=mysql_fetch_array($infuz);


$room_inf = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `rooms` WHERE `rm`='$uzin[room]'"));

$check_room = mysql_fetch_assoc(mysql_query("SELECT * FROM `rooms` WHERE `rm`='$uzin[room]' LIMIT 1"));
if(!$check_room){
$room_inf['name']='Прихожая';
}

echo '<a href="photo.php?id='.$uzin['photo'].'"><img src="imgs/no_photo.gif" width="75" height="75" align="left"/></a> <b>'.$uzin['login'].'</b><br>
Последний раз был в: <b>'.date('H:i / d.m',$uzin['rtime']).'</b> (<a href="room.php?rm='.$uzin['room'].'"><b><u>'.$room_inf['name'].'</u></b></a>)<br>
Статус на сайте: <b><u>';

if($uzin['status']==6){ echo 'Администратор чата'; }elseif($uzin['status']==5){ echo 'Модератор чата'; }elseif($uzin['status']==4){ echo 'Шаман чата'; }elseif($uzin['status']==3){ echo 'VIP'; }elseif($uzin['status']==2){ echo 'Бывалый'; }elseif($uzin['status']==1){ echo 'Пользователь'; }

echo '</u></b><br>
<br><br><br>';

$amuls=mysql_result(mysql_query("SELECT COUNT(*) FROM `amuls` WHERE `id_user`='$uzin[id]'"), 0);
$prokl=mysql_result(mysql_query("SELECT COUNT(*) FROM `prokl` WHERE `id_user`='$uzin[id]'"), 0);

echo '<div class="menu">
<b>Амулетов</b>: <font color="#a00"><b>'.$amuls.'</b></font><br>
<b>Проклятий</b>: <font color="#a00"><b>'.$prokl.'</b></font><br><br>
<b>Поинтов</b>: <font color="#a00"><b>'.$uzin['points'].'</b></font><br>
<b>Кредитов</b>: <font color="#a00"><b>'.$uzin['credits'].'</b></font><br>
<a href="faq.php?rating"><b>Рейтинг</b></a>: <font color="#a00"><b>'.$uzin['rating'].'</b></font> (<font color="#a00"><b>'.$uzin['posts'].'</b></font> постов)
<br><br>';

$love = mysql_fetch_assoc(mysql_query("SELECT `id`,`login` FROM `users` WHERE `id`='$uzin[love]'")); //запрос на логин юзера


echo '<b>Семейное положение</b>: ';
if($uzin['love']==""){

echo 'не в браке';

}else{

echo 'в браке с <a href="/u'.$love['id'].'"><font color="#a00"><b>'.$love['login'].'</b></font></a>';

}

echo '</small>
<br><br><br>';


echo'<table width="100%"><tr>
<td width="100%" valign="top" style="border:1px solid #666666;background:#EAEAEA;padding:3px;"><b>Подарки:</b><br><br>';

$count_pres=mysql_result(mysql_query("SELECT COUNT(*) FROM `presents` WHERE `id_user`='$uzin[id]'"), 0);

$pres_q=mysql_query("SELECT * FROM `presents` WHERE `id_user`='$uzin[id]' ORDER BY `id`");

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `presents` WHERE id_user=$uzin[id]"), 0);
if($total==0){
echo 'Нет подарков :(';
}else{

while($post=mysql_fetch_array($pres_q)){

$present = mysql_fetch_assoc(mysql_query("SELECT `id_present`,`name`,`img`,`price` FROM `shop` WHERE `id_present`='$post[id_present]'")); //запрос на логин юзера

if($present['id_present']==1 or $present['id_present']==2 or $present['id_present']==3 or $present['id_present']==4){

echo '<img src="'.$present['img'].'" align="left" style="margin:1px 5px 1px 0px;"/>';

}else{

echo '<img src="'.$present['img'].'" align="left" style="margin:1px 5px 1px 0px;" width="50" height="50"/>';

}
}

}

echo '</td></tr></table></div>';
echo $_down;
}else{

header ("Location: /?"); exit;

}

?>