Файл: odet.php
Строк: 584
<?php
include_once("files/zag.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
$lvl=trim($udata9);
switch($tip) {
case 'weapon':
$qi = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_dam']);
$data[0]=trim($row['p_dam']);
$data[6]=trim($row['bodypart']);
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
/////////////////////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`='baffatk' LIMIT 1");
$user2=mysql_num_rows($us2);
if($user2==1){
$user1=mysql_fetch_array($us2);
$udata4=$udata4-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata4`='$udata4' WHERE `udata0`='$log'");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffatk' ");
}
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`='baffmatk' LIMIT 1");
$user2=mysql_num_rows($us2);
if($user2==1){
$user1=mysql_fetch_array($us2);
$udata83=$udata83-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata83`='$udata83' WHERE `udata0`='$log'");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmatk' ");
}
////////////////////////////////////////////////////////////////////////
$udat12=trim($udata12);
$udat45=trim($udata45);
$udat4=trim($udata4);
$udat83=trim($udata83);
if($data[6]=="lrhand"){
if($udat12=="Пусто" and $udat45=="Пусто"){
$udat12=$data[4];
$udat4=trim($udata4+$data[0]);
$udat83=trim($udata83+$data[5]);
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat12', `id` = '$id', `vid` = 'weapon', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'weapon' ");
mysql_query("UPDATE `users` SET `udata12`='$udat12', `udata45`='$udat12' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata4`='$udat4', `udata83`='$udat83' WHERE `udata0`='$log'"); echo"Вещь $udat12 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='weapon' LIMIT 1");
if (mysql_affected_rows()==0)
{
echo "Ошибка";
}
else
{
$row=mysql_fetch_array($qi2);
$udat4=trim($udata4);
$udat83=trim($udata83);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat4-$GLOBAL;
$opit1=$udat83-$mGLOBAL;
$udat12=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
$shield = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='shield' LIMIT 1");
$shi=mysql_num_rows($shield);
if($shi==1){
$sh=mysql_fetch_array($shield);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udat3=$udat3-$sh[fiz];
$udat82=$udat82-$sh[mag];
mysql_query("DELETE FROM `odet` WHERE `tip`='shield' and `login`='$log' and `vid`='armor' ");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
}
mysql_query("DELETE FROM `odet` WHERE `tip`='weapon' and `login`='$log' and `vid`='weapon' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat12', `id` = '$id', `vid` = 'weapon', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'weapon' ");
mysql_query("UPDATE `users` SET `udata12`='$udat12', `udata45`='$udat12' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata4`='$atk', `udata83`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat12 одета!";
}}
}else{
if($udat12=="Пусто"){
$udat12=$data[4];
$udat4=$udata4+$data[0];
$udat83=$udata83+$data[5];
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat12', `id` = '$id', `vid` = 'weapon', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'weapon' ");
mysql_query("UPDATE `users` SET `udata12`='$udat12', `udata83`='$udat83' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata4`='$udat4' WHERE `udata0`='$log'"); echo"Вещь $udat12 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='weapon' LIMIT 1");
if (mysql_affected_rows()==0)
{
echo "Ошибка";
}
else
{
$row=mysql_fetch_array($qi2);
$udat4=trim($udata4);
$udat83=trim($udata83);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat4-$GLOBAL;
$opit1=$udat83-$mGLOBAL;
$udat4=$opit+$data[0];
$udat83=$opit1+$data[5];
$udat12=$data[4];
mysql_query("DELETE FROM `odet` WHERE `tip`='weapon' and `login`='$log' and `vid`='weapon' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat12', `id` = '$id', `vid` = 'weapon', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'weapon' ");
$weapon = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='$udata12' LIMIT 1");
$wea=mysql_fetch_array($weapon);
if($wea[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$udat12', `udata45`='Пусто' WHERE `udata0`='$log'");}else{mysql_query("UPDATE `users` SET `udata12`='$udat12' WHERE `udata0`='$log'");}
mysql_query("UPDATE `users` SET `udata4`='$udat4', `udata83`='$udat83' WHERE `udata0`='$log'"); echo"Вещь $udat12 одета!";
}}
}
}
}
break;
case 'body':
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($row['bodypart']!=="chest" and $row['bodypart']!=="fullarmor" and $row['bodypart']!=="legs"){echo"<small>Это не доспехи</small>"; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
///////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
//////////////////////////////////////////////////
$udat11=trim($udata11);
$udat84=trim($udata84);
$udat3=trim($udata3);
$udat82=trim($udata82);
if($row[bodypart]=="fullarmor"){
if($udat11=="Пусто" and $udat84=="Пусто"){
$udat11=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'fullarmor' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11', `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
echo"Вещь $udat11 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='fullarmor' LIMIT 1");
$full=mysql_num_rows($qi2);
$qi3 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='chest' LIMIT 1");
$che=mysql_num_rows($qi3);
$qi4 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='legs' LIMIT 1");
$legs=mysql_num_rows($qi4);
if($full==1){
$ful=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$ful[fiz];
$udatas82=$udat82-$ful[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$udat11=$data[4];
mysql_query("DELETE FROM `odet` WHERE `tip`='fullarmor' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'fullarmor' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11', `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat11 одета!";
}elseif($che==1){
$ch=mysql_fetch_array($qi3);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$ch[fiz];
$udatas82=$udat82-$ch[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$qi4 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='legs' LIMIT 1");
$legs=mysql_num_rows($qi4);
if($legs==1){
$leg=mysql_fetch_array($qi4);
$udatas3=$udat3-$leg[fiz];
$udatas82=$udat82-$leg[mag];
$udat3=$udatas3;
$udat82=$udatas82;
}
$udat11=$data[4];
mysql_query("DELETE FROM `odet` WHERE (`tip`='chest' or `tip`='fullarmor' or `tip`='legs') and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'fullarmor' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11', `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat11 одета!";
}elseif($legs==1){
$leg=mysql_fetch_array($qi4);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$leg[fiz];
$udatas82=$udat82-$leg[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$qi3 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='chest' LIMIT 1");
$che=mysql_num_rows($qi3);
if($che==1){
$ch=mysql_fetch_array($qi3);
$udatas3=$udat3-$ch[fiz];
$udatas82=$udat82-$ch[mag];
$udat3=$udatas3;
$udat82=$udatas82;
}
$udat11=$data[4];
mysql_query("DELETE FROM `odet` WHERE (`tip`='chest' or `tip`='fullarmor' or `tip`='legs') and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'fullarmor' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11', `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat11 одета!";
}
}
}else
if($row[bodypart]=="chest"){
if($udat11=="Пусто"){
$udat11=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'chest' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
echo"<small>Теперь ваша защита больше ;)</small>";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='fullarmor' LIMIT 1");
$full=mysql_num_rows($qi2);
$qi3 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='chest' LIMIT 1");
$che=mysql_num_rows($qi3);
$qi4 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='legs' LIMIT 1");
$legs=mysql_num_rows($qi4);
if($full==1){
$ful=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$ful[fiz];
$udatas82=$udat82-$ful[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$udat11=$data[4];
mysql_query("DELETE FROM `odet` WHERE `tip`='fullarmor' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'chest' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11', `udata84`='Пусто' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat11 одета!";
}elseif($che==1){
$ch=mysql_fetch_array($qi3);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$ch[fiz];
$udatas82=$udat82-$ch[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$udat11=$data[4];
mysql_query("DELETE FROM `odet` WHERE `tip`='chest' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'chest' ");
mysql_query("UPDATE `users` SET `udata11`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat11 одета!";
}
}
}else
if($row[bodypart]=="legs"){
if($udat84=="Пусто"){
$udat11=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat11', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'legs' ");
mysql_query("UPDATE `users` SET `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
echo"<small>Теперь ваша защита больше ;)</small>";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='fullarmor' LIMIT 1");
$full=mysql_num_rows($qi2);
$qi3 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='chest' LIMIT 1");
$che=mysql_num_rows($qi3);
$qi4 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='legs' LIMIT 1");
$legs=mysql_num_rows($qi4);
if($full==1){
$ful=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$ful[fiz];
$udatas82=$udat82-$ful[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$udat84=$data[4];
mysql_query("DELETE FROM `odet` WHERE `tip`='fullarmor' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat84', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'legs' ");
mysql_query("UPDATE `users` SET `udata11`='Пусто', `udata84`='$udat84' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat84 одета!";
}elseif($legs==1){
$leg=mysql_fetch_array($qi4);
$udat3=trim($udata3);
$udat82=trim($udata82);
$udatas3=$udat3-$leg[fiz];
$udatas82=$udat82-$leg[mag];
$udat3=$udatas3+$data[0];
$udat82=$udatas82+$data[5];
$udat84=$data[4];
mysql_query("DELETE FROM `odet` WHERE `tip`='legs' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat84', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'legs' ");
mysql_query("UPDATE `users` SET `udata84`='$udat84' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'"); echo"Вещь $udat84 одета!";
}
}
}
}}
break;
case 'shield':
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="shield"){echo"<small>Это не Щит</small>"; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
///////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
//////////////////////////////////////////////////
$udat45=trim($udata45);
$udat3=trim($udata3);
$udat82=trim($udata82);
if($udat45=="Пусто"){
$udat45=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata45`='$udat45' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat45', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'shield' ");
echo"<small>Теперь ваша защита больше ;)</small>";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='shield' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat45=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
$shield = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='$udata12' LIMIT 1");
$shi=mysql_fetch_array($shield);
if($shi[bodypart]=="lrhand"){
$udat4=trim($udata4);
$udat83=trim($udata83);
$udat4=$udat4-$shi[p_dam];
$udat83=$udat83-$shi[m_dam];
mysql_query("DELETE FROM `odet` WHERE `tip`='weapon' and `login`='$log' and `vid`='weapon' ");
mysql_query("UPDATE `users` SET `udata4`='$udat4', `udata83`='$udat83', `udata12`='Пусто' WHERE `udata0`='$log'");
}
mysql_query("DELETE FROM `odet` WHERE `tip`='shield' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat45', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'shield' ");
mysql_query("UPDATE `users` SET `udata45`='$udat45' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat45 одета!";
}
}}
break;
case 'gloves':
$file=file("data/item/$log.dat");
$file = array_reverse($file);
$data = explode(":||:",$file[$id]);
$total=count($file);
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="gloves"){echo"<small>Это не Перчатки</small>"; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
///////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
//////////////////////////////////////////////////
$udat46=trim($udata46);
$udat3=trim($udata3);
$udat82=trim($udata82);
if($udat46=="Пусто"){
$udat46=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata46`='$udat46' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat46', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'gloves' ");
echo"Вы одели $udat46";
}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='gloves' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat46=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='gloves' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat46', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'gloves' ");
mysql_query("UPDATE `users` SET `udata46`='$udat46' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat46 одета!";
}
}}
break;
case 'ukrashenia':
$file=file("data/item/$log.dat");
$file = array_reverse($file);
$data = explode(":||:",$file[$id]);
$total=count($file);
$qi = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['uda2']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['uda3']);
$data[4]=trim($row['uda4']);
$data[5]=trim($row['uda5']);
$data[0]=trim($row['uda0']);
if($data[2]!=="ukrashenia"){echo"<small>Это не украшения</small>"; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="B" || $data[3]=="A" || $data[3]=="D" ||$data[3]=="C" || $data[3]=="S"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="B" || $data[3]=="A" || $data[3]=="C" || $data[3]=="S"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="B" || $data[3]=="A" || $data[3]=="S"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="A" || $data[3]=="S"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="S"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
$udat40=trim($udata40);
$udat17=trim($udata17);
if($udat40=="Пусто"){
$udat40=$data[4];
$udat17=$udat17+$data[0];
mysql_query("UPDATE `users` SET `udata40`='$udat40' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata17`='$udat17' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat40', `id` = '$id', `vid` = 'ykr', `fiz` = '$data[0]', `tip` = 'ykr' ");
echo"<small>Вы одели украшения;)</small>";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='ykr' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat40=trim($udata40);
$udat17=trim($udata17);
$GLOBAL=$row['fiz'];
$opit=$udat17-$GLOBAL;
$udat40=$data[4];
$atk=trim($opit+$data[0]);
mysql_query("DELETE FROM `odet` WHERE `tip`='ykr' and `login`='$log' and `vid`='ykr' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat40', `id` = '$id', `vid` = 'ykr', `fiz` = '$data[0]', `tip` = 'ykr' ");
mysql_query("UPDATE `users` SET `udata40`='$udat40' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata17`='$atk' WHERE `udata0`='$log'"); echo"Вещь $udat40 одета!";
}
}}
break;
case 'feet':
$file=file("data/item/$log.dat");
$file = array_reverse($file);
$data = explode(":||:",$file[$id]);
$total=count($file);
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="feet"){echo"<small>Это не Сапоги</small>"; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
///////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
//////////////////////////////////////////////////
$udat13=trim($udata13);
$udat3=trim($udata3);
$udat82=trim($udata82);
if($udat13=="Пусто"){
$udat13=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat13', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'feet' ");
mysql_query("UPDATE `users` SET `udata13`='$udat13' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
echo"<small>Теперь ваша защита больше ;)</small>";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='feet' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat13=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='feet' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat13', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'feet' ");
mysql_query("UPDATE `users` SET `udata13`='$udat13' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat13 одета!";
}
}}
break;
case 'head':
$file=file("data/item/$log.dat");
$file = array_reverse($file);
$data = explode(":||:",$file[$id]);
$total=count($file);
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="head"){echo"<small>Это не шлем</small>"; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
///////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
//////////////////////////////////////////////////
$udat10=trim($udata10);
$udat3=trim($udata3);
$udat82=trim($udata82);
if($udat10=="Пусто"){
$udat10=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata10`='$udat10' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$udat3', `udata82`='$udat82' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat10', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'head' ");
echo"<small>Теперь ваша защита больше ;)</small>";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='head' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat10=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='head' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat10', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'head' ");
mysql_query("UPDATE `users` SET `udata10`='$udat10' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat10 одета!";
}
}}
break;
case 'ring':
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' limit 1");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
$row=mysql_fetch_array($qi);
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="ring"){echo"Это не серьга."; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
$qi = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `id`='".$id."' and `vid`='armor' ");
$kol=mysql_num_rows($qi);
if($kol==1){echo"У вас уже одета эта вещь!";include_once"files/down.php";exit;}
$udat77=trim($udata77);
$udat82=trim($udata82);
$udat3=trim($udata3);
if($kyda==""){
echo'<a href="odet.php?&tip=ring&go=go&id='.$id.'&kyda=left">Левая рука</a></br>';
echo'<a href="odet.php?&tip=ring&go=go&id='.$id.'&kyda=right">Правая рука</a></br>';
}else{
if($kyda=="left"){
$qi = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `id`='".$id."' and `vid`='armor' ");
$kol=mysql_num_rows($qi);
if($udat77=="Пусто"){
$udat77=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata77`='$udat77' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$udat82', `udata3`='$udat3' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat77', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'leftring' ");
echo"Вещь $udat77 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='leftring' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat77=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='leftring' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat77', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'leftring' ");
mysql_query("UPDATE `users` SET `udata77`='$udat77' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat77 одета!";
}}else{
if($udat78=="Пусто"){
$udat78=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata78`='$udat78' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$udat82', `udata3`='$udat3' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat78', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'rightring' ");
echo"Вещь $udat78 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='rightring' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat78=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='rightring' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat78', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'rightring' ");
mysql_query("UPDATE `users` SET `udata78`='$udat78' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat78 одета!";
}
}
}
}
break;
case 'earning':
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' limit 1");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
$row=mysql_fetch_array($qi);
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="earning"){echo"Это не серьга."; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
$udat79=trim($udata79);
$udat82=trim($udata82);
$udat3=trim($udata3);
$qi = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `id`='".$id."' and `vid`='armor' ");
$kol=mysql_num_rows($qi);
if($kol==1){echo"У вас уже одета эта вещь!";include_once"files/down.php";exit;}
if($kyda==""){
echo'<a href="odet.php?&tip=earning&go=go&id='.$id.'&kyda=left">Левое ухо</a></br>';
echo'<a href="odet.php?&tip=earning&go=go&id='.$id.'&kyda=right">Правое ухо</a></br>';
}else{
if($kyda=="left"){
if($udat79=="Пусто"){
$udat79=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata79`='$udat79' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$udat82', `udata3`='$udat3' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat79', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'leftearning' ");
echo"Вещь $udat79 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='leftearning' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat79=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='leftearning' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat79', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'leftearning' ");
mysql_query("UPDATE `users` SET `udata79`='$udat79' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat79 одета!";
}}else{
if($udat80=="Пусто"){
$udat80=$data[4];
$udat3=$udat3+$data[0];
$udat82=$udat82+$data[5];
mysql_query("UPDATE `users` SET `udata80`='$udat80' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$udat82', `udata3`='$udat3' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat80', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'rightearning' ");
echo"Вещь $udat80 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='rightearning' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat80=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='rightearning' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat80', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'rightearning' ");
mysql_query("UPDATE `users` SET `udata80`='$udat80' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat80 одета!";
}
}
}
}
break;
case 'neck':
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$data[2]=trim($row['bodypart']);
$data[1]=trim($row['uda1']);
$data[3]=trim($row['crystal_type']);
$data[4]=trim($row['name']);
$data[5]=trim($row['m_def']);
$data[0]=trim($row['p_def']);
if($data[2]!=="neck"){echo"Это не ожерелье."; include_once"files/down.php";exit;}
if($lvl<="19"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="d" ||$data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="39"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="c" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="51"){ if($data[3]=="b" || $data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="60"){ if($data[3]=="a" || $data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
if($lvl<="75"){ if($data[3]=="s"){ echo"Вы не можете одеть одежду не по lvl!";include_once"files/down.php";exit;}}
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`!='baffatk' and `name`!='baffmatk' ");
$user2=mysql_num_rows($us2);
if($user2==1){
while($user1=mysql_fetch_array($us2)){
if($user1[name]=="baffarmor"){
$udata3=$udata3-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
}
if($user1[name]=="baffmzashita"){
$udata82=$udata82-$user1[kol_sila];
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
}}
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffarmor' ");
mysql_query("UPDATE `baffs` SET `active`='off' WHERE `login`='$log' AND `name`='baffmzashita' ");
}
$udat81=trim($udata81);
$udat82=trim($udata82);
$udat3=trim($udata3);
if($udat81=="Пусто"){
$udat81=$data[4];
$udat82=$udat82+$data[5];
$udat3=$udat3+$data[0];
mysql_query("UPDATE `users` SET `udata81`='$udat81' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$udat82', `udata3`='$udat3' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat81', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'neck' ");
echo"Вещь $udat81 одета!";}else{
$qi2 = mysql_query("SELECT * from `odet` WHERE `login`='".$log."' and `tip`='neck' LIMIT 1");
$row=mysql_fetch_array($qi2);
$udat3=trim($udata3);
$udat82=trim($udata82);
$GLOBAL=$row['fiz'];
$mGLOBAL=$row['mag'];
$opit=$udat3-$GLOBAL;
$opit1=$udat82-$mGLOBAL;
$udat81=$data[4];
$atk=trim($opit+$data[0]);
$matk=trim($opit1+$data[5]);
mysql_query("DELETE FROM `odet` WHERE `tip`='neck' and `login`='$log' and `vid`='armor' ");
mysql_query("INSERT INTO `odet` SET `login` = '$log', `vesh` = '$udat81', `id` = '$id', `vid` = 'armor', `fiz` = '$data[0]', `mag` = '$data[5]', `tip` = 'neck' ");
mysql_query("UPDATE `users` SET `udata81`='$udat81' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$atk', `udata82`='$matk' WHERE `udata0`='$log'"); echo"Вещь $udat81 одета!";
}
}}
break;
case 'vesh':
echo"<small>Ты не можешь надеть вещь она для продажи!</small>";
break;
}
}
include_once"files/down.php";
?>