Файл: war/war/shopelexirs.php
Строк: 73
<?
define('PROTECTOR', 1);
$headmod = 'shopelexirs';//фикс. места
$textl='Магазин Элексиров';
include('files/path.php');
include('files/gzips.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
going();
ryd();
place_okr();
place_zamok();
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');
switch($_GET[mod]){
default:
$req = mysql_query("SELECT * FROM `shopelexirs` WHERE `city` = '$udata[city]' and `tip`='elexir'");
////////////////////////////
$avto=mysql_num_rows($req);
While($mag = mysql_fetch_array($req))
{
echo"<img src="pic/tip/$mag[name].gif" height=32 width=32> <a href="shopelexirs.php?mod=info&id=$mag[id]">$mag[name]</a> ($mag[cena] cеребра) [<a href="shopelexirs.php?mod=sell&id=$mag[id]">купить</a>]<br/>";
}
echo'<hr>'; echo "» <a href="gorod.php?pl=shop_zone"> Вернуться</a><br>";
break;
case 'info':
$req = mysql_query("SELECT * FROM `shopelexirs` WHERE `city` = '$udata[city]' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$avto=mysql_num_rows($req);
if($avto==0){
echo'Ошибка!';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$mag = mysql_fetch_array($req);
switch($mag[what]){
case 'hp':
$tip='жизнь';
break;
case 'mp':
$tip='ману';
break;
}
echo"<b>$mag[name]</b><br/>
<img src="pic/tip/$mag[name].gif" height=32 width=32><br/>
Востанавливает: $tip<br/>
Едениц: $mag[give]<br/>
Цена: $mag[cena]<br/>
";
echo'<hr>'; echo "» <a href="shopelexirs.php?"> Вернуться</a><br>";
break;
case 'sell':
$req = mysql_query("SELECT * FROM `shopelexirs` WHERE `city` = '$udata[city]' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$avto=mysql_num_rows($req);
if($avto==0){
echo'Ошибка, такой вещи нет!';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$mag = mysql_fetch_array($req);
$nmoney=$udata[money]-$mag[cena];
if($nmoney<0){
echo'Не хватает серебра!';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req1 = mysql_query("SELECT * FROM `res` WHERE `usr` = '$log' and `lat_name` = '$mag[lat_name]'");
$res = mysql_fetch_array($req1);
$avto1=mysql_num_rows($req1);
if($avto1==0){
mysql_query("INSERT INTO
`res` SET
`usr` = '$log',
`name` = '$mag[name]',
`lat_name` = '$mag[lat_name]',
`tip` = '$mag[tip]',
`what` = '$mag[what]',
`give` = '$mag[give]',
`kol` = '1',
`cena` = '$mag[cena]'");
}else{
$nk=$res[kol]+1;
mysql_query("UPDATE `res` SET `kol` = '$nk' WHERE `usr` = '$log' and `lat_name` = '$mag[lat_name]'");
}
mysql_query("UPDATE users SET money = '$nmoney' WHERE usr = '$log'");
echo"
Вещь $mag[name] куплена и помещена в инвентарь!<br/>
Серебра потрачено: $mag[cena]<br/>
Серебра осталось: $nmoney<br/>
";
echo'<hr>'; echo "» <a href="shopelexirs.php?"> Вернуться</a><br>";
break;
}
include($path.'files/down.php');
include($path.'files/meny.php');
?>