Файл: inc/petfarm/level_all.php
Строк: 32
<?
include_once '../system/config.php';
if(isset($_GET['level_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['level_all'])."' AND `id_user` = '$ku[id]' AND `id_pet` != '0' AND `level` < '20'"),0)!=0)
{
$petground=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['level_all'])."' AND `id_user` = '$ku[id]' AND `id_pet` != '0' AND `level` < '20'"));
$petground['next_level']=$petground['level']+1;
$money_all_levels=0;
for($kp=$petground['next_level'];$kp<=20;$kp++)
{
$money_all_levels=$money_all_levels+$kp;
}
$money_all_levels=$money_all_levels*1000;
if($ku['money']>=$money_all_levels)
{
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-$money_all_levels)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_petground` SET `level` = '20' WHERE `id` = '$petground[id]'");
}
else $_SESSION['no_money']=$ku['money']-$money_all_levels;
header("Location:/barnyard/moderate");
exit;
}
?>