<?
if(isset($_GET['myfarm']) && isset($_GET['water']) && intval($_GET['water'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id` = '".intval($_GET['water'])."' AND `id_user` = '$ku[id]' AND (`soil` = '0' AND `time_soil` > '$time' OR `soil` = '1')"),0)!=0)
{
$ground=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_ground` WHERE `id` = '".intval($_GET['water'])."' AND `id_user` = '$ku[id]'"));
if($ground['time_water']<=$time && $ground['id_plant']!=0 && $ground['time']>$time)
{
$nt=1800;
$rat=ir($ku['level']);
$rat_hp_act=0; //гидра
$rat_mc_hp_act=0; //ороситель
$rat_irregate_act=0; //оПроситель

if(isset($hp_act))$rat_hp_act=(($rat/100)*$hp_ps);
if(isset($mc_hp_act))$rat_mc_hp_act=(($rat/100)*$mc_hp_ps);
if(isset($irregate_act))$rat_irregate_act=(($rat/100)*$irregate_act);
if(isset($shmel_act))$rat_irregate_act=$rat_irregate_act*2;
if(isset($shmel_act))$rat_hp_act=$rat_hp_act*2;

$rat=double_exp(base_exp($rat)+$rat_hp_act+$rat_mc_hp_act+$rat_irregate_act);

$ntt=15*60;
$ntt_hp_act=0;
$ntt_mc_hp_act=0;
if(isset($hp_act))$ntt_hp_act=(($ntt/100)*$hp_ps);
if(isset($mc_hp_act))$ntt_mc_hp_act=(($ntt/100)*$mc_hp_ps);
$ntt=$ntt_hp_act+$ntt_mc_hp_act;
if(isset($irregate_act))
{
$nt=$nt-(round($irregate_act_mnp*60));
$ntt=$ntt+($irregate_act_m*60);
}
mysql_query("UPDATE `kolhoz_ground` SET `time_water` = '".($time+$nt)."', `time` = '".($ground['time']-$ntt)."' 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:/myfarm/".passgen());
}
else header("Location:/myfarm/".passgen());
exit;
}
?>