<?php
include 'system/bd.php';
include 'system/cook.php';
include ("system/gzip.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include 'system/head.php';

switch($_GET[mod]){
default:




echo "<div class='title'>Заточка </div>";



$req = mysql_query("SELECT `id`,`name`,`images`,`hone`,`quality` FROM `item` WHERE `user` = '$user[id]' and `wearing`='yes' and `tip`='head'");
$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'<div class="empty_block">';
echo"
 <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/head/$mag[images].png'>
</td><td> <font color=LightCoral> <img src='img/star/$mag[quality].png'> $mag[name]</font> [$mag[hone]/$hone] 
</br> $quality $q
</td></tr>
</tbody></table></div>";
if($mag[hone] <= $hone){
echo" <div class='link_center'> 
<a href='hone.php?mod=plus&id=$mag[id]&tip=head'>1000</a> </div>";
}else{
echo" <div class='link_center_h'> 
<a href='?'>Заточено</a> </div>";
}
}else{
$a1 = 1;}
                     /////
$req = mysql_query("SELECT `id`,`name`,`images`,`hone`,`quality` FROM `item` WHERE `user` = '$user[id]' and `wearing`='yes' and `tip`='shoulder'");
$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'<div class="empty_block">';
echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/shoulder/$mag[images].png'>
</td><td> 
<font color=LightCoral> <img src='img/star/$mag[quality].png'> $mag[name]</font> [$mag[hone]/$hone]
</br> $quality $q
</td></tr>
</tbody></table></div>";
if($mag[hone] <= $hone){
echo" <div class='link_center'> 
<a href='hone.php?mod=plus&id=$mag[id]&tip=shoulder'>1000</a></div>";
}else{
echo" <div class='link_center_h'> 
<a href='?'> Заточено</a></div>";
}
}else{
$a2=1;}
                  /////
$req = mysql_query("SELECT `id`,`name`,`images`,`hone`,`quality` FROM `item` WHERE `user` = '$user[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'<div class="empty_block">';
echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/body/$mag[images].png'>
</td><td> 
<font color=LightCoral> <img src='img/star/$mag[quality].png'> $mag[name]</font> [$mag[hone]/$hone]
</br> $quality $q
</td></tr>
</tbody></table></div>";
if($mag[hone] <= $hone){
echo" <div class='link_center'>
<a href='hone.php?mod=plus&id=$mag[id]&tip=body'>1000</a> </div>";
}else{
echo" <div class='link_center_h'>
<a href='?'>Заточено</a> </div>";
}
}else{
$a3=1;}
                /////
$req = mysql_query("SELECT `id`,`name`,`images`,`hone`,`quality` FROM `item` WHERE `user` = '$user[id]' and `wearing`='yes' and `tip`='weapon'");
$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'<div class="empty_block">';
echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/weapon/$mag[images].png'>
</td><td> 
<font color=LightCoral> <img src='img/star/$mag[quality].png'> $mag[name]</font> [$mag[hone]/$hone]
</br> $quality
</td></tr>
</tbody></table></div>";
if($mag[hone] <= $hone){
echo" <div class='link_center'> 
<a href='hone.php?mod=plus&id=$mag[id]&tip=weapon'>1000</a> </div>";
}else{
echo" <div class='link_center_h'> 
<a href='?'>Заточено</a> </div>";
}
}else{
$a4=1;}
                   /////
$req = mysql_query("SELECT `id`,`name`,`images`,`hone`,`quality` FROM `item` WHERE `user` = '$user[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'<div class="empty_block">';
echo" <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/shield/$mag[images].png'>
</td><td> 
<font color=LightCoral> <img src='img/star/$mag[quality].png'> $mag[name]</font> [$mag[hone]/$hone]
</br> $quality
</td></tr>
</tbody></table></div>";
if($mag[hone] <= $hone){
echo" <div class='link_center'> 
<a href='hone.php?mod=plus&id=$mag[id]&tip=shield'>1000</a> </div>";
}else{
echo" <div class='link_center_h'> 
<a href='?'>Заточено</a> </div>";
}
}else{
$a5=1;}
                    /////

$a=$a1+$a2+$a3+$a4+$a5;
if($a == 5){
echo" <div class='empty_block item_center'>Нет вещей</div>";}
break;
//
case'plus':
$req = mysql_query("SELECT * FROM `item` WHERE `user` = '$user[id]' ||`wearing`='yes' ||
`id`='".mysql_real_escape_string($_GET['id'])."' AND `tip`= '".mysql_real_escape_string($_GET['tip'])."'");
$avto=mysql_num_rows($req);
if($_GET[tip]!=head && $_GET[tip]!=shoulder && $_GET[tip]!=body && $_GET[tip]!=weapon && $_GET[tip]!=shield){
header ("Location: hone.php"); exit;
}
if($avto==1){
header ("Location: hone.php"); exit;
exit;
}
$mag = mysql_fetch_array($req);
if($mag[quality] == '0'){
$quality= Хлам;}
if($mag[quality] == '1'){
$quality= Обычный;}
if($mag[quality] == '2'){
$quality= Необычный;}
if($mag[quality] == '3'){
$quality= Редкий;}
if($mag[quality] == '4'){
$quality= Эпический;}
if($mag[quality] == '5'){
$quality= Легендарный;}
if($mag[quality] == '6'){
$quality= Мифический;}

mysql_query("UPDATE `user` SET `attack`= `attack` + '2',
`def`= `def` + '2' ,
`hpfull`= `hpfull` + '2' 
WHERE `id`='$user[id]'");

mysql_query("UPDATE `item` SET hone = `hone` + '1' WHERE `user` = '$user[id]' and `tip`='".mysql_real_escape_string($_GET['tip'])."' and `id`='".mysql_real_escape_string($_GET['id'])."' ");

header ("Location: hone.php"); exit;
break;

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