 <?php
require_once ('system/func.php');
auth(); // Закроем от не авторизованных
# Настройки #
$id = abs(intval($_GET['id']));
if($id){
$prof = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
# Ошибки #
if(!$prof){
$_SESSION['msg'] == 'Такой игрок не существует';
header('Location: /equipment/');
exit();
}

$title = 'Снаряжение - '.$prof['login'];
require_once ('system/header.php');

$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$prof['id']."' AND `odeta` = 'da' AND `tip` = 'golova' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Голова</a></li></div>";
}else{
echo "<div class='block_l'>";
echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
echo "<small> $item[name] </small></span></a></li></div>";
}

$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$prof['id']."' AND `odeta` = 'da' AND `tip` = 'plechi' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Плечи</a></li></div>";

}else{
        
    echo "<div class='block_l'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";



}

$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$prof['id']."' AND `odeta` = 'da' AND `tip` = 'tors' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Голова</a></li></div>";

}else{
    
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small>
 $item[name] </small></font></span></a></li></div>";

}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$prof['id']."' AND `odeta` = 'da' AND `tip` = 'perchatki' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
    echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Плечи </a></li></div>";

}else{
        
    echo "<div class='block_l'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}

    


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` =  '".$prof['id']."' AND `odeta` = 'da' AND `tip` = 'prav' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Оружие </a></li></div>";

}else{
        
    echo "<div class='block_l'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}

$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$prof['id']."'  AND `odeta` = 'da' AND `tip` = 'lev' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Оружие </a></li></div>";

}else{
        
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";



}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$prof['id']."'  AND `odeta` = 'da' AND `tip` = 'nogi' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
    echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Штаны </a></li></div>";

}else{

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


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` =  '".$prof['id']."' AND `odeta` = 'da' AND `tip` = 'obuv' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
    echo "<li><a><div class='block_l'>".item('icons', 'item_null.png')." Сапоги </a></li></div>";


}else{
       
    echo "<div class='block_l'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}


}else{
     

 

switch($item['skill']){
case '0':
$color = '<font color="green">';
$bonus=10;

break;
case '100':
$color = '<font color="#1E90FF">';
$bonus=20;
break;
case '500':
$color = '<font color="violet">';
$bonus=40;

break;
case '2500':
$color = '<font color="gold"> ';
$bonus=70;

break;

case '5000':
$color = '<font color="Darkorange"> ';
$bonus=100;

break;
}


$title = 'Снаряжение';
require_once ('system/header.php');
$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$myID."' AND `odeta` = 'da' AND `tip` = 'golova' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);

if(!$item){

echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Голова</a></li></div>";



}else{






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


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";


}

$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$myID."' AND `odeta` = 'da' AND `tip` = 'plechi' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){

echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Плечи </a></li></div>";

}else{
 


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


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
if($item[bonus] >= 0)echo "  <span class='info' style='float:right;'>   </font></span>";
echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";



}

$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$myID."' AND `odeta` = 'da' AND `tip` = 'tors' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Торс </a></li></div>";

}else{
    
    
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
if($item[bonus] >= 0)echo "  <span class='info' style='float:right;'>   </font></span>";
echo "<small> >$color$item[name] </small></font></a></li></div>";

}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$myID."' AND `odeta` = 'da' AND `tip` = 'perchatki' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
  echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')."Перчатки</a></li></div>";

}else{
        
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
if($item[bonus] >= 0)echo "  <span class='info' style='float:right;'>   </font></span>";
echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}

    


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` =  '".$myID."' AND `odeta` = 'da' AND `tip` = 'prav' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
    echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Оружие </a></li></div>";

}else{
        
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
echo "<small> $item[name] </small></font></span></a></li></div>";

}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$myID."'  AND `odeta` = 'da' AND `tip` = 'lev' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Оружие </a></li></div>";

}else{
        
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
if($item[bonus] >= 0)echo "  <span class='info' style='float:right;'>   </font></span>";
echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";




}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` = '".$myID."'  AND `odeta` = 'da' AND `tip` = 'nogi' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
    echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Штаны </a></li></div>";

}else{
        
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";

echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}


$item = mysql_query("SELECT * FROM `inv` WHERE `id_user` =  '".$myID."' AND `odeta` = 'da' AND `tip` = 'obuv' ORDER BY `id` LIMIT 1");
$item = mysql_fetch_array($item);
if(!$item){
   echo "<li><a><div class='wrapper'>".item('icons', 'item_null.png')." Сапоги </a></li></div>";

}else{
       
    echo "<div class='wrapper'>";


echo "<li><img src='/images/items/$item[tip]/$item[item].png' class='bord'><a href='/item/$item[id]'>";
if($item[bonus] >= 0)echo "  <span class='info' style='float:right;'>   </font></span>";
echo "<span class='item-".skill($item['skill'])."'><small> $item[name] </small></font></span></a></li></div>";

}


echo "</div>";
}
require_once ('system/footer.php');
?>