Файл: alh.php
Строк: 159
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$textl='Алхимик';
include($path.'files/core.php');
if(isset($_GET['cr']))
{
if($_GET['el']==1)
{
if($_POST['kol']<1)
{
header('location: ?');exit;
}
$kl=round($_POST['kol'])*5;
if($udata['kl']<$kl)
{
header('location: ?');exit;
}
else
{
$ukl=$udata['kl']-$kl;
mysql_query("UPDATE `users` SET `kl`='".$ukl."' WHERE `id`='".$udata['id']."'");
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `ef`='100'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
$kol=round($_POST['kol']);
mysql_query("INSERT INTO `elic` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='hp',
`kol`='".$kol."',
`time`='0',
`ef`='100',
`status`='off',
`rest`='20'
");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$kol=round($_POST['kol']);
$el=mysql_fetch_array($eq);
$ko=$el['kol']+$kol;
mysql_query("UPDATE `elic` SET `kol`='".$ko."' WHERE `id`='".$el['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
if($udata['kv_d']==14)
{
$kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
header('location: ?yes');exit;
}
}
if($_GET['el']==2)
{
if($_POST['kol']<1)
{
header('location: ?');exit;
}
$kl=round($_POST['kol'])*10;
$fm=round($_POST['kol'])*3;
if($udata['kl']<$kl or $udata['fm']<$fm)
{
header('location: ?');exit;
}
else
{
$ukl=$udata['kl']-$kl;
$ufm=$udata['fm']-$fm;
mysql_query("UPDATE `users` SET `kl`='".$ukl."', `fm`='".$ufm."' WHERE `id`='".$udata['id']."'");
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `ef`='500'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
$kol=round($_POST['kol']);
mysql_query("INSERT INTO `elic` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='hp',
`kol`='".$kol."',
`time`='0',
`ef`='500',
`status`='off',
`rest`='40'
");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$kol=round($_POST['kol']);
$el=mysql_fetch_array($eq);
$ko=$el['kol']+$kol;
mysql_query("UPDATE `elic` SET `kol`='".$ko."' WHERE `id`='".$el['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
if($udata['kv_d']==14)
{
$kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
header('location: ?yes');exit;
}
}
if($_GET['el']==3)
{
if($_POST['kol']<1)
{
header('location: ?');exit;
}
$kl=round($_POST['kol'])*30;
$fm=round($_POST['kol'])*10;
if($udata['kl']<$kl or $udata['fm']<$fm)
{
header('location: ?');exit;
}
else
{
$ukl=$udata['kl']-$kl;
$ufm=$udata['fm']-$fm;
mysql_query("UPDATE `users` SET `kl`='".$ukl."', `fm`='".$ufm."' WHERE `id`='".$udata['id']."'");
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `ef`='1000'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
$kol=round($_POST['kol']);
mysql_query("INSERT INTO `elic` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='hp',
`kol`='".$kol."',
`time`='0',
`ef`='1000',
`status`='off',
`rest`='60'
");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$kol=round($_POST['kol']);
$el=mysql_fetch_array($eq);
$ko=$el['kol']+$kol;
mysql_query("UPDATE `elic` SET `kol`='".$ko."' WHERE `id`='".$el['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
if($udata['kv_d']==14)
{
$kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
header('location: ?yes');exit;
}
}
if($_GET['el']==4)
{
if($_POST['kol']<1)
{
header('location: ?');exit;
}
$kl=round($_POST['kol'])*60;
$fm=round($_POST['kol'])*15;
if($udata['kl']<$kl or $udata['fm']<$fm)
{
header('location: ?');exit;
}
else
{
$ukl=$udata['kl']-$kl;
$ufm=$udata['fm']-$fm;
mysql_query("UPDATE `users` SET `kl`='".$ukl."', `fm`='".$ufm."' WHERE `id`='".$udata['id']."'");
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `ef`='5000'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
$kol=round($_POST['kol']);
mysql_query("INSERT INTO `elic` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='hp',
`kol`='".$kol."',
`time`='0',
`ef`='5000',
`status`='off',
`rest`='90'
");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$kol=round($_POST['kol']);
$el=mysql_fetch_array($eq);
$ko=$el['kol']+$kol;
mysql_query("UPDATE `elic` SET `kol`='".$ko."' WHERE `id`='".$el['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
if($udata['kv_d']==14)
{
$kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
header('location: ?yes');exit;
}
}
if($_GET['el']==5)
{
if($_POST['kol']<1)
{
header('location: ?');exit;
}
$kl=round($_POST['kol'])*120;
$fm=round($_POST['kol'])*35;
if($udata['kl']<$kl or $udata['fm']<$fm )
{
header('location: ?');exit;
}
else
{
$ukl=$udata['kl']-$kl;
$ufm=$udata['fm']-$fm;
mysql_query("UPDATE `users` SET `kl`='".$ukl."', `fm`='".$ufm."' WHERE `id`='".$udata['id']."'");
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `ef`='20000'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
$kol=round($_POST['kol']);
mysql_query("INSERT INTO `elic` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='hp',
`kol`='".$kol."',
`time`='0',
`ef`='20000',
`status`='off',
`rest`='120'
");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$kol=round($_POST['kol']);
$el=mysql_fetch_array($eq);
$ko=$el['kol']+$kol;
mysql_query("UPDATE `elic` SET `kol`='".$ko."' WHERE `id`='".$el['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['alh_exp']+$kol;
mysql_query("UPDATE `users_dost` SET `alh_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
if($udata['kv_d']==14)
{
$kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
header('location: ?yes');exit;
}
}
}
include($path.'files/head.php');
include($path.'files/zag.php');
if(isset($_GET['yes']))
{
echo '<div class="bat m bts brs bls bbs p"><font color=#00ff00>Вы успешно сварили эликсиры!</font></div>';
}
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Алхимик</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">
<div align=center><img src=img/inter/11.jpg></div>
<div class="v4 p"><font color=#ff9900>Алхимик с радостью продаст вам свои зелья</font></div>
<font color=#ff9900><b>Ресурсы:</b></font><br>
<img src=img/main/r18.png> '.$udata['kd'].' <img src=img/main/r16.png> '.$udata['kl'].'
<img src=img/main/r17.png> '.$udata['fm'].' <br>
<div class="tor p m bts bbs brs bls"> <img src=img/elic/hp100.png> исцелитель<br>
Перезарадка: <img src=img/main/e12.png> 20сек.<br>
Лечит: <img src=img/main/p6.png> +100<br>
Состав: <img src=img/main/r16.png> 5<br>
<form action=?cr&el=1 method=POST>
Кол-во: <input type=text name=kol size=4><input type=submit class=line value=варить>
</form>
</div>
<div class="tor p m bts bbs brs bls"> <img src=img/elic/hp500.png> оживитель<br>
Перезарадка: <img src=img/main/e12.png> 40сек.<br>
Лечит: <img src=img/main/p6.png> +500<br>
Состав: <img src=img/main/r16.png> 10 <img src=img/main/r17.png> 3
<form action=?cr&el=2 method=POST>
Кол-во: <input type=text name=kol size=4><input type=submit class=line value=варить>
</form>
</div>
<div class="tor p m bts bbs brs bls"> <img src=img/elic/hp1000.png> воскреситель<br>
Перезарадка: <img src=img/main/e12.png> 60сек.<br>
Лечит: <img src=img/main/p6.png> +1000<br>
Состав: <img src=img/main/r16.png> 30 <img src=img/main/r17.png> 10 <br>
<form action=?cr&el=3 method=POST>
Кол-во: <input type=text name=kol size=4><input type=submit class=line value=варить>
</form>
</div>
<div class="tor p m bts bbs brs bls"> <img src=img/elic/hp5000.png> восстановитель<br>
Перезарадка: <img src=img/main/e12.png> 90сек.<br>
Лечит: <img src=img/main/p6.png> +5000<br>
Состав: <img src=img/main/r16.png> 60 <img src=img/main/r17.png> 15<br>
<form action=?cr&el=4 method=POST>
Кол-во: <input type=text name=kol size=4><input type=submit class=line value=варить>
</form>
</div>
<div class="tor p m bts bbs brs bls"> <img src=img/elic/hp20000.png> возродитель<br>
Перезарадка: <img src=img/main/e12.png> 120сек.<br>
Лечит: <img src=img/main/p6.png> +100%<br>
Состав: <img src=img/main/r16.png> 120 <img src=img/main/r17.png> 35
<br>
<form action=?cr&el=5 method=POST>
Кол-во: <input type=text name=kol size=4><input type=submit class=line value=варить>
</form>
</div>
';
echo '</div></div>';
include('files/down.php');
?>