Файл: l2ps_v5/snyat.php
Строк: 278
<?php
include_once("files/zagarena.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{
include_once"files/up.php";
switch($tip) {
case 'weapon':
if($udata12!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
/////////////////////////////////////////////////////////////
$us2 = mysql_query("SELECT * FROM `baffs` WHERE `login`='$log' AND `active`='on' AND `name`='baffarmor' LIMIT 1");
$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' ");
}
////////////////////////////////////////////////////////////////////////
$udat12=trim($udata12);
$udat45=trim($udata45);
$udat4=trim($udata4);
$udat83=trim($udata83);
$qi = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
if (mysql_affected_rows()==0)
{
echo "Вещь не существует!";
}
else
{
while($row=mysql_fetch_array($qi))
{
if($row['bodypart']=="lrhand"){
if($udat12!=="Пусто" and $udat45!=="Пусто"){
$GLOBAL=$row['p_dam'];
$mGLOBAL=$row['m_dam'];
$udat12="Пусто";
$id=trim($row['item_id']);
$opit=$udat4-$GLOBAL;
$opit1=$udat83-$mGLOBAL;
mysql_query("UPDATE `users` SET `udata12`='$udat12', `udata45`='$udat12' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata4`='$opit', `udata83`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='weapon' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}else{
if($udat12!=="Пусто"){
$GLOBAL=trim($row['p_dam']);
$mGLOBAL=trim($row['m_dam']);
$udat12="Пусто";
$opit=$udat4-$GLOBAL;
$opit1=$udat83-$mGLOBAL;
mysql_query("UPDATE `users` SET `udata12`='$udat12' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata4`='$opit', `udata83`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `login`='$log' and `tip`='weapon' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}
}
}
break;
case 'body':
if($udata11!=="$name" and $udata84!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
///////////////////////////////////////////////
$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="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata11`='$udat11', `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}else
if($row[bodypart]=="chest"){
if($udat11!=="Пусто"){
$udat11="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata11`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}else
if($row[bodypart]=="legs"){
if($udat84!=="Пусто"){
$udat11="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata84`='$udat11' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}
}}
break;
case 'shield':
if($udata45!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
$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($row['uda6']!=="dual"){
if($udat45!=="Пусто"){
$udat45="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata45`='$udat45' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}else{echo"Ошибка!";}
}}
break;
case 'gloves':
if($udata46!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
///////////////////////////////////////////////
$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="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata46`='$udat46' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}}
break;
case 'ukrashenia':
if($udata40!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$file = @file("data/item/$log.dat");
$total=count($file);
for($i=0; $i<$total; $i++){
$data = explode(":||:",$file[$i]);
if($name==$data[4]){
}}
$qi = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['uda0']);
$id=trim($row['item_id']);
$udat40=trim($udata40);
$udat17=trim($udata17);
if($udat40!=="Пусто"){
$udat40="Пусто";
$opit=$udat17-$GLOBAL[l];
mysql_query("UPDATE `users` SET `udata40`='$udat40' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata17`='$opit' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='ykr' ");
$text=$udat[0].':||:'.$udat[1].':||:'.$udat[2].':||:'.$opit.':||:'.$udat[4].':||:'.$udat[5].':||:'.$udat[6].':||:'.$udat[7].':||:'.$udat[8].':||:'.$udat[9].':||:'.$udat[10].':||:'.$udat[11].':||:'.$udat[12].':||:'.$udat[13].':||:'.$udat[14].':||:'.$udat[15].':||:'.$udat[16].':||:'.$udat[17].':||:'.$udat[18].':||:'.$udat[19].':||:'.$udat[20].':||:'.$udat[21].':||:'.$udat[22].':||:'.$udat[23].':||:'.$udat[24].':||:'.$udat[25].':||:'.$udat[26].':||:'.$udat[27].':||:'.$udat[28].':||:'.$udat[29].':||:'.$udat[30].':||:'.$udat[31].':||:'.$udat[32].':||:'.$udat[33].':||:'.$udat[34].':||:'.$udat[35].':||:'.$udat[36].':||:'.$udat[37].':||:'.$udat[38].':||:'.$udat[39].':||:'.$udat[40].':||:'.$udat[41].':||:'.$udat[42].':||:'.$udat[43].':||:'.$udat[44].':||:'.$udat[45].':||:'.$udat[46].':||:'.$udat[47].':||:'.$udat[48].':||:'.$udat[49].':||:'.$udat[50].':||:'.$udat[51].':||:'.$udat[52].':||:'.$udat[53].':||:'.$udat[54].':||:'.$udat[55].':||:'.$udat[56].':||:'.$udat[57].':||:'.$udat[58].':||:'.$udat[59].':||:'.$udat[60].':||:'.$udat[61].':||:'.$udat[62].':||:'.$udat[63].':||:'.$udat[64].':||:'.$udat[65].':||:'.$udat[66].':||:'.$udat[67].':||:'.$udat[68].':||:'.$udat[69].':||:'.$udat[70].':||:'.$udat[71].':||:'.$udat[72].':||:'.$udat[73].':||:'.$udat[74].':||:'.$udat[75].':||:'.$udat[76].':||:'.$udat[77].':||:'.$udat[78].':||:'.$udat[79].':||:'.$udat[80].':||:'.$udat[81].':||:'.$udat[82].':||:'.$udat[83].':||:'.$udat[84].':||:'.$udat[85].':||:'.$udat[86].':||:'.$udat[87].':||:'.$udat[88].':||:'.$udat[89].':||:'.$udat[90].':||:'.$udat[91].':||:'.$udat[92].':||:'.$udat[93].':||:'.$udat[94].':||:'.$udat[95].':||:'.$udat[96].':||:'.$udat[97].':||:'.$udat[98].':||:'.$udat[99].':||:'.$udat[100].':||:';
$fp=fopen("data/reg/$log.dat","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp); echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}}
break;
case 'nogi':
if($udata13!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
///////////////////////////////////////////////
$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="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata13`='$udat13' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}}
break;
case 'golova':
if($udata10!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
///////////////////////////////////////////////
$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="Пусто";
$opit=$udat3-$GLOBAL[l];
$opit1=$udat82-$data[5];
mysql_query("UPDATE `users` SET `udata10`='$udat10' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata3`='$opit', `udata82`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}}
break;
case 'ring':
if($ruka=="right"){
if($udata78!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }}else{if($udata77!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }}
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
$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' ");
}
if($ruka=="right"){
$udat78=trim($udata78);
$udat82=trim($udata82);
$udat3=trim($udata3);
if($udat78!=="Пусто"){
$udat78="Пусто";
$opit=$udat82-$data[5];
$opit1=$udat3-$GLOBAL[l];
mysql_query("UPDATE `users` SET `udata78`='$udat78' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$opit', `udata3`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}}else{
$udat77=trim($udata77);
$udat82=trim($udata82);
$udat3=trim($udata3);
if($udat77!=="Пусто"){
$udat77="Пусто";
$opit=$udat82-$data[5];
$opit1=$udat3-$GLOBAL[l];
mysql_query("UPDATE `users` SET `udata77`='$udat77' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$opit', `udata3`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}}
}}
break;
case 'earring':
if($earning=="right"){
if($udata80!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }}else{if($udata79!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }}
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `item_id`='".$id."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$id=trim($row['item_id']);
$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' ");
}
if($earning=="right"){
$udat80=trim($udata80);
$udat82=trim($udata82);
$udat3=trim($udata3);
if($udat80!=="Пусто"){
$udat80="Пусто";
$opit=$udat82-$data[5];
$opit1=$udat3-$GLOBAL[l];
mysql_query("UPDATE `users` SET `udata80`='$udat80' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$opit', `udata3`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}else{
$udat79=trim($udata79);
$udat82=trim($udata82);
$udat3=trim($udata3);
if($udat79!=="Пусто"){
$udat79="Пусто";
$opit=$udat82-$data[5];
$opit1=$udat3-$GLOBAL[l];
mysql_query("UPDATE `users` SET `udata79`='$udat79' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$opit', `udata3`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$id' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}}}
break;
case 'necklace':
if($udata81!=="$name"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$name."' LIMIT 1");
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']);
$GLOBAL[l]=trim($row['p_def']);
$data[5]=trim($row['m_def']);
$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="Пусто";
$opit=$udat82-$data[5];
$opit1=$udat3-$GLOBAL[l];
mysql_query("UPDATE `users` SET `udata81`='$udat81' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata82`='$opit', `udata3`='$opit1' WHERE `udata0`='$log'");
mysql_query("DELETE FROM `odet` WHERE `id`='$row[item_id]' and `login`='$log' and `vid`='armor' ");
echo"<small>Снято.</small>";}else{echo"Вам нечего снимать...";}
}}
break;
}
}
include_once"files/down.php";
?>