View file techno/alhimiya.php

File size: 3.02Kb
<?
define('PROTECTOR', 1);

$headmod = 'shop';//фикс. места

$textl='Аптечки и др.';
@include('files/db.php');
@include('files/auth.php');
@include('files/func.php');
going();
@include('files/core.php');
@include('files/head.php');
@include('files/zag.php');
echo"<font color=\"#ffc22b\">Пополнить здоровье и энергию можно с помощью средств, расположенных ниже</font>$div";
if(isset($_GET[sell])){
$id=htmlspecialchars(stripslashes(addslashes($_GET['id'])));
$req = mysql_query("SELECT * FROM `shopelexirs` WHERE `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 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)*15));}

$nmoney=$udata[money]-($mag[cena]*$_POST[kol]);

if($nmoney<0){
echo'Не хватает монет!';
@include('files/down.php');
exit;}
if(empty($_POST[kol])){echo'
<form action="alhimiya.php?sell&id='.$id.'" method="post"><b>Сколько?</b><br/><input class="input" name="kol"  type="text"/><br/><input type="submit" value="Продолжить"/></form>';}else{
$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($_POST[kol]<=0){
echo"Не верное значение!";
@include('files/down.php');exit;}
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` = '$_POST[kol]',
        `cena` = '$mag[cena]'");
        
}else{
$nk=$res[kol]+$_POST[kol];
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'");
$cena=$mag[cena]*$_POST[kol];
echo"
<font color='#71cc71'>Вещь $mag[name] куплена и помещена в инвентарь!</font><br/>
Монет потрачено: $cena<br/>
Монет осталось: $nmoney<br/>
";}






}

$req = mysql_query("SELECT * FROM `shopelexirs` WHERE `tip`='elexir' ORDER BY give ASC");
////////////////////////////
$avto=mysql_num_rows($req);
While($mag = mysql_fetch_array($req)){
echo"<img src=\"pic/main/$mag[what]e.png\" alt=\"*\"/> <a href=\"alhimiya.php?mod=info&id=$mag[id]\">$mag[name]
</a> <img src=\"pic/bazar.gif\" alt=\"*\"/>$mag[cena] <a href=\"alhimiya.php?sell&id=$mag[id]\">купить</a><br/>";}
echo'</div><div class=menu><a href="javascript:history.go(-1)">Назад</a></div>';



@include('files/down.php');
?>