Файл: l2ps_v5/sellshop.php
Строк: 131
<?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{
switch($_GET[act]){
default:
if($udata20=="Talking Island Village"){
$nalog=3;
}
if($udata20=="Dark Elven Village"){
$nalog=3;
}
if($udata20=="Elven Village"){
$nalog=3;
}
if($udata20=="Orc Village"){
$nalog=3;
}
if($udata20=="Dwarven Village"){
$nalog=3;
}
if($udata20=="Gludin Village"){
$nalog=3;
}
if($udata20=="Hunters Village"){
$nalog=3;
}
if($udata20=="Floran Village"){
$nalog=3;
}
if($udata20=="Town of Gludio"){
$nalog=7;
}
if($udata20=="Town of Dion"){
$nalog=7;
}
if($udata20=="Town of Giran"){
$nalog=18;
}
if($udata20=="Town of Goddard"){
$nalog=12;
}
if($udata20=="Heine"){
$nalog=6;
}
if($udata20=="Town of Aden"){
$nalog=11;
}
if($udata20=="Town of Oren"){
$nalog=5;
}
if($udata20=="Town of Schuttgart"){
$nalog=9;
}
if($udata20=="Rune Township"){
$nalog=9;
}
if($_GET[vid]=="weapon"){
$req = mysql_query("SELECT * FROM `l2pirates_weapon` WHERE `item_id`='$id'");
$avto=mysql_num_rows($req);
if($avto==0){
echo'Ошибка, такой вещи нет!';
include('files/down.php');
exit;
}
$mag = mysql_fetch_array($req);
///////////////
$req = mysql_query("SELECT * FROM `zamok` WHERE `name`='$udata20'");
////////////////////////////
$avto=mysql_fetch_array($req);
$ma=($mag[price]*$nalog)/100;
$mag[price] = $mag[price]+$ma;
/////////////
$nmoney=$udata8-$mag[price];
if($nmoney<0){
echo'Нехватает аден!';
include('files/down.php');
exit;
}
mysql_query("INSERT INTO
`weapon_item` SET
`login` = '$log',
`name` = '$mag[name]',
`bodypart` = '$mag[bodypart]',
`crystallizable` = '$mag[crystallizable]',
`weight` = '$mag[weight]',
`soulshots` = '$mag[soulshots]',
`spiritshots` = '$mag[spiritshots]',
`material` = '$mag[material]',
`crystal_type` = '$mag[crystal_type]',
`p_dam` = '$mag[p_dam]',
`rnd_dam` = '$mag[rnd_dam]',
`weaponType` = '$mag[weaponType]',
`critical` = '$mag[critical]',
`atk_speed` = '$mag[atk_speed]',
`m_dam` = '$mag[m_dam]',
`price` = '$mag[price]',
`mp_consume` = '$mag[mp_consume]'");
}else{
$req = mysql_query("SELECT * FROM `l2pirates_armor` WHERE `item_id`='$_GET[id]'");
$avto=mysql_num_rows($req);
if($avto==0){
echo'Ошибка, такой вещи нет!';
include('files/down.php');
exit;
}
$mag = mysql_fetch_array($req);
///////////////
$req = mysql_query("SELECT * FROM `zamok` WHERE `name`='$udata20'");
////////////////////////////
$avto=mysql_fetch_array($req);
$ma=($mag[price]*$nalog)/100;
$mag[price] = $mag[price]+$ma;
/////////////
$nmoney=$udata8-$mag[price];
if($nmoney<0){
echo'Нехватает аден!';
include('files/down.php');
exit;
}
mysql_query("INSERT INTO
`armor_item` SET
`login` = '$log',
`name` = '$mag[name]',
`bodypart` = '$mag[bodypart]',
`crystallizable` = '$mag[crystallizable]',
`weight` = '$mag[weight]',
`material` = '$mag[material]',
`crystal_type` = '$mag[crystal_type]',
`p_def` = '$mag[p_def]',
`m_def` = '$mag[m_def]',
`mp_bonus` = '$mag[mp_bonus]',
`kartinka` = '$mag[kartinka]',
`price` = '$mag[price]'");
}
mysql_query("INSERT INTO `zametki` VALUES ('', 'Вы купили вещь $mag[name] в магазине за $mag[price] аден ', 'Система', '".$time."/".$date."', '".$log."')");
//////////////////////////////////////////////////////////////////////////////////////////////
if($udata20=="Talking Island Village" or $udata20=="Dark Elven Village" or $udata20=="Elven Village" or $udata20=="Orc Village" or $udata20=="Dwarven Village" or $udata20=="Gludin Village" or $udata20=="" or $udata20=="Hunters Village"){
$aglava=mysql_query("SELECT * FROM `zamok` WHERE `name`='$udata20' ");
$arrs= mysql_fetch_array($aglava);
$ggad=$arrs['clan'];
$ggg2=$arrs['nalog'];
$nalog=explode(".",$ggg2);
$aglavaff=mysql_query("SELECT * FROM `vilage` WHERE `name`='$udata20' ");
$arrsff= mysql_fetch_array($aglavaff);
$gga1=$arrsff['money'];
$gga1=$gga1+$ma;
mysql_query("UPDATE `vilage` SET `money`='$gga1' WHERE `name`='$udata20'"); }else{
$aglava=mysql_query("SELECT * FROM `zamok` WHERE `name`='$udata20' ");
$arrs= mysql_fetch_array($aglava);
$ggad=$arrs['clan'];
$aglavaf=mysql_query("SELECT * FROM `clan` WHERE `clan0`='$ggad' ");
$arrsf= mysql_fetch_array($aglavaf);
$gga=$arrsf['clan4'];
$gga=$gga+$ma;
mysql_query("UPDATE `clan` SET `clan4`='$gga' WHERE `clan0`='$ggad'");
$ma=number_format($ma);
$time1 = date("H:i:s/d.m.y");
mysql_query("INSERT INTO clanlog SET clan='$ggad',msg='$time1 - получен налог $ma аден с замка $udata20 ' ");
}
mysql_query("UPDATE users SET udata8 = '$nmoney' WHERE udata0 = '$log'");
$mag[price] = number_format($mag[price]);
$nmoney = number_format($nmoney);
echo"
Вещь $mag[name] куплена и помещена в инвентарь!<br/>
Аден потрачено: $mag[price]<br/>
Аден осталось: $nmoney<br/>
";
echo"<a href="shop.php?">Назад</a>";
break;
case 'ask':
echo'Вы действительно хотите купить эту вещь?<br/>';
echo"<a href="sellshop.php?id=$_GET[id]&vid=$_GET[vid]">Да</a><br/>";
echo"<a href="shop.php?">Нет</a>";
break;
}}
include_once"files/down.php";
?>