Файл: playtox.tk/sell.php
Строк: 64
<?
define('PROTECTOR', 1);
$textl='Магазин';
@include('files/db.php');
@include('files/auth.php');
@include('files/func.php');
going();
ryd();
place_okr();
place_tower();
@include('files/core.php');
@include('files/head.php');
@include('files/zag.php');
switch($_GET[act]){
default:
$req = mysql_query("SELECT * FROM `shop` WHERE `city` = '$udata[city]' and `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 domination WHERE id = '1'");
$dom = mysql_fetch_assoc($req);
if($dom['white']>$dom['black']){
$liders='white';
}elseif($dom['black']>$dom['white']){
$liders='black';
}else{
$liders='not';}
if($udata['storona']==$liders){
$mag[cena]=round($mag[cena]-(($mag[cena]/100)*10));}
/////////////
$b = mysql_query("SELECT * FROM bazar WHERE baz_tip = 'item' and city = '$udata[city]' and `id`='$_GET[id]' ORDER BY id DESC");
////////////////////////////
$avto=mysql_num_rows($b);
$best = mysql_fetch_array($b);
$nmoney=$udata[money]-$mag[cena];
if($nmoney<0){
echo'Нехватает монет!';
@include('files/down.php');
exit;}
mysql_query("INSERT INTO
`item` SET
`usr` = '$log',
`tip` = '$mag[tip]',
`name` = '$mag[name]',
`cena` = '$mag[cena]',
`umin` = '$mag[umin]',
`umax` = '$mag[umax]',
`pgolova` = '$mag[pgolova]',
`pbody` = '$mag[pbody]',
`pnogi` = '$mag[pnogi]',
`hp` = '$mag[hp]',
`mp` = '$mag[mp]',
`krit` = '$mag[krit]',
`ukrit` = '$mag[ukrit]',
`antikrit` = '$mag[antikrit]',
`sila` = '$mag[sila]',
`lovk` = '$mag[lovk]',
`um` = '$mag[um]',
`prot` = '$mag[prot]',
`klas` = '$mag[klas]',
`nsila` = '$mag[nsila]',
`num` = '$mag[num]',
`nlovk` = '$mag[nlovk]',
`nlvl` = '$mag[nlvl]',
`ncena` = '$best[cena]',
`image` = 'not'");
mysql_query("UPDATE users SET money = '$nmoney' WHERE usr = '$log'");
echo"Вещь $mag[name] куплена и помещена в инвентарь!<br/>
Монет потрачено: $mag[cena]<br/>
Монет осталось: $nmoney<br/>";
echo"<a href="shop.php?">Назад</a>";
break;
case 'ask':
echo'Вы действительно хотите купить эту вещь?<br/>';
echo"<a href="sell.php?id=$_GET[id]">Да</a><br/>";
echo"<a href="shop.php?">Нет</a>";
break;}
@include('files/down.php');
?>