<?php
include 'system/bd.php';
include 'system/cook.php';
include ("system/gzip.php");

if(isset($_SESSION['auth']) && $_SESSION['auth']==1 && isset($_GET['id'])){
include 'system/head.php';

if (intval($_GET['id'])==$user['id']){
	header("Location: /user.php");
	exit;
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id`='".intval($_GET['id'])."'"),0)){
	$us=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`='".intval($_GET['id'])."'"));
}else{
	 header('Location: index.php?');
	exit;
}

switch($_GET[mod]){
default:

echo "<div class='title'> Снаряжение $us[login] </div>";

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



$req = mysql_query("SELECT `id`,`name`,`images`,`quality`,`hone` FROM `item` WHERE `user` = '$us[id]' and `tip`='head' and `wearing`='yes'");
$avto=mysql_num_rows($req);
if($avto==1){
$mag = mysql_fetch_array($req);
$w=explode("*",$mag[name]);

 if($mag[quality] == '0'){
$quality= Хлам;
$hone = 5;}
if($mag[quality] == '1'){
$quality= Обычный;
$hone = 10;}
if($mag[quality] == '2'){
$quality= Необычный;
$hone = 15;}
if($mag[quality] == '3'){
$quality= Редкий;
$hone = 25;}
if($mag[quality] == '4'){
$quality= Эпический;
$hone = 30;}
if($mag[quality] == '5'){
$quality= Легендарный;
$hone = 40;}
if($mag[quality] == '6'){
$quality= Мифический;
$hone = 50;} 

echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/head/$mag[images].png'>
</td><td>
<img src='img/star/$mag[quality].png'> <a href=\"equipment_1.php?mod=info&id=$us[id]&item=$mag[id]\">
<font color=LightCoral>$mag[name]</font></a> [$mag[hone]/$hone] 
</br> $quality
</td></tr>
</tbody></table>";
}else{
echo" <img src='/img/items/head/0.png'> Голова: не одето 
</br>";
}
                ///////////
$req = mysql_query("SELECT `id`,`name`,`images`,`quality`,`hone` FROM `item` WHERE `user` = '$us[id]' and `tip`='shoulder' and `wearing`='yes'");
$avto=mysql_num_rows($req);
if($avto==1){
$mag = mysql_fetch_array($req);
$w=explode("*",$mag[name]);

if($mag[quality] == '0'){
$quality= Хлам;
$hone = 5;}
if($mag[quality] == '1'){
$quality= Обычный;
$hone = 10;}
if($mag[quality] == '2'){
$quality= Необычный;
$hone = 15;}
if($mag[quality] == '3'){
$quality= Редкий;
$hone = 25;}
if($mag[quality] == '4'){
$quality= Эпический;
$hone = 30;}
if($mag[quality] == '5'){
$quality= Легендарный;
$hone = 40;}
if($mag[quality] == '6'){
$quality= Мифический;
$hone = 50;}

echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/shoulder/$mag[images].png'>
</td><td> 
<img src='img/star/$mag[quality].png'> <a href=\"equipment_1.php?mod=info&id=$us[id]&item=$mag[id]\">
<font color=LightCoral>$mag[name]</font></a> [$mag[hone]/$hone] 
</br> $quality
</td></tr>
</tbody></table>";
}else{
echo" <img src='/img/items/shoulder/0.png'> Наплечник: не одето </br> ";
}
                  //////////
$req = mysql_query("SELECT `id`,`name`,`images`,`quality`,`hone` FROM `item` WHERE `user` = '$us[id]' and `tip`='body' and `wearing`='yes'");
$avto=mysql_num_rows($req);
if($avto==1){
$mag = mysql_fetch_array($req);
$w=explode("*",$mag[name]);

if($mag[quality] == '0'){
$quality= Хлам;
$hone = 5;}
if($mag[quality] == '1'){
$quality= Обычный;
$hone = 10;}
if($mag[quality] == '2'){
$quality= Необычный;
$hone = 15;}
if($mag[quality] == '3'){
$quality= Редкий;
$hone = 25;}
if($mag[quality] == '4'){
$quality= Эпический;
$hone = 30;}
if($mag[quality] == '5'){
$quality= Легендарный;
$hone = 40;}
if($mag[quality] == '6'){
$quality= Мифический;
$hone = 50;}

echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/body/$mag[images].png'>
</td><td> 
<img src='img/star/$mag[quality].png'> <a href=\"equipment_1.php?mod=info&id=$us[id]&item=$mag[id]\"> <font color=LightCoral>$mag[name]</font></a> [$mag[hone]/$hone] 
</br> $quality
</td></tr>
</tbody></table>";
}else{
echo" <img src='/img/items/body/0.png'> Тело: не одето </br> ";
}
                    /////////
$req = mysql_query("SELECT `id`,`name`,`images`,`quality`,`hone` FROM `item` WHERE `user` = '$us[id]' and `tip`='weapon' and `wearing`='yes'");
$avto=mysql_num_rows($req);
if($avto==1){
$mag = mysql_fetch_array($req);
$w=explode("*",$mag[name]);

if($mag[quality] == '0'){
$quality= Хлам;
$hone = 5;}
if($mag[quality] == '1'){
$quality= Обычный;
$hone = 10;}
if($mag[quality] == '2'){
$quality= Необычный;
$hone = 15;}
if($mag[quality] == '3'){
$quality= Редкий;
$hone = 25;}
if($mag[quality] == '4'){
$quality= Эпический;
$hone = 30;}
if($mag[quality] == '5'){
$quality= Легендарный;
$hone = 40;}
if($mag[quality] == '6'){
$quality= Мифический;
$hone = 50;}

echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/weapon/$mag[images].png'>
</td><td> 
<img src='img/star/$mag[quality].png'> <a href=\"equipment_1.php?mod=info&id=$us[id]&item=$mag[id]\"> <font color=LightCoral>$mag[name]</font></a> [$mag[hone]/$hone] 
</br> $quality
</td></tr>
</tbody></table>";
}else{
echo" <img src='/img/items/weapon/0.png'> Оружие: не одето </br> ";
}
                 ////////////
$req = mysql_query("SELECT `id`,`name`, `images`,`quality`,`hone` FROM `item` WHERE `user` = '$us[id]' and `tip`='shield' and `wearing`='yes'");
$avto=mysql_num_rows($req);
if($avto==1){
$mag = mysql_fetch_array($req);
$w=explode("*",$mag[name]);

if($mag[quality] == '0'){
$quality= Хлам;
$hone = 5;}
if($mag[quality] == '1'){
$quality= Обычный;
$hone = 10;}
if($mag[quality] == '2'){
$quality= Необычный;
$hone = 15;}
if($mag[quality] == '3'){
$quality= Редкий;
$hone = 25;}
if($mag[quality] == '4'){
$quality= Эпический;
$hone = 30;}
if($mag[quality] == '5'){
$quality= Легендарный;
$hone = 40;}
if($mag[quality] == '6'){
$quality= Мифический;
$hone = 50;}

echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/shield/$mag[images].png'>
</td><td>
<img src='img/star/$mag[quality].png'> <a href=\"equipment_1.php?mod=info&id=$us[id]&item=$mag[id]\"> <font color=LightCoral>$mag[name]</font></a> [$mag[hone]/$hone] 
</br> $quality
</td></tr>
</tbody></table>";
}else{
echo" <img src='/img/items/shield/0.png'> Щит: не одето";
}


echo'</div> <div class="block_link">
<a href="users.php?id='.$acc[id].'"> <img src="/img/foot/index.png" alt="*"/> Вернуться к '.$us[login].'</a></div>';
break;
case 'info':

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id`='".intval($_GET['id'])."'"),0)){
	$us=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`='".intval($_GET['id'])."'"));
}else{
	header('Location: index.php?');
	exit;
}


$req = mysql_query("SELECT * FROM `item` WHERE `user` = '$us[id]' and `id`='".mysql_real_escape_string($_GET['item'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==0){
header ("Location: index.php?");
exit;
}

$req = mysql_query("SELECT * FROM `item` WHERE `user` = '$us[id]' and `id`='".mysql_real_escape_string($_GET['item'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto>=1){
$mag= mysql_fetch_array($req);

echo"Вещь игрока $us[login]: <b>$mag[name]</b><br>
Атака: <u>".number_format($mag[ataka])."</u> <img src=\"pic/main/strength.png\"><br>
Защита: <u>".number_format($mag[zah])."</u> <img src=\"pic/main/defense.png\"><br>
Бонус здоровья: <u>".number_format($mag[hp])."</u> <img src=\"pic/main/hp.png\"><br>
Бонус энергии: <u>".number_format($mag[mp])."</u> <img src=\"pic/main/mp.png\"><br>
Требования: <u>$mag[lvl]</u> <img src=\"pic/main/up.png\"> Уровень / <u>".number_format($mag[bic])."</u> <img src=\"pic/main/bica.gif\"> бицухи";

}

echo'<div class="ssl">';
	echo '<a class="navi" href="statictika_infa.php?id='.$acc[id].'">&nbsp <img src="/pic/main/rotate.png" alt="*"/> Вернуться к '.$acc[login].'</a></div>';

}
}else{
header ("Location: index.php"); exit;
}
include 'system/foot.php';
?>
