Файл: inc/petfarm/water.php
Строк: 22
<?
include_once '../system/config.php';
if(isset($_GET['water']) && intval($_GET['water'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['water'])."' AND `id_user` = '$ku[id]' AND `time_corm` > '$time' AND `time_water` < '$time'"),0)!=0)
{
$pet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['water'])."' AND `id_user` = '$ku[id]' AND `time_corm` > '$time' AND `time_water` < '$time'"));
$rat=$ku['level'];
$rat_drakon_act=0;
$rat_sc_act=0;
$rat_feeder_act=0;
$rat_school_act=0;
$rat_lib_act=0;
$rat_medal=0;
if(isset($sc_act))$rat_sc_act=$rat*2;
if(isset($feeder_act))$rat_feeder_act=($rat*(80+(40*$feeder_act)))/100;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat*2;
if(isset($shmel_act))$rat_feeder_act=$rat_feeder_act*2;
if($mc['MedalRating']>0)$rat_medal=(($rat/100)*($mc['MedalRating']*0.5));
$ratt=floor($rat_drakon_act+$rat_sc_act+$rat_feeder_act+$rat_school_act+$rat_lib_act+$rat_medal);
if($ratt==0)$rat=$rat;
else $rat=$ratt;
if(isset($dexp))$rat=$rat*2;
if(isset($exp3))$rat=$rat*3;
mysql_query("UPDATE `kolhoz_petground` SET `time_water` = '".($time+1800)."' WHERE `id` = '".intval($_GET['water'])."' LIMIT 1");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$rat;
update_mc($rat);
}
header("Location:/barnyard/");
exit;
?>