<?

if(isset($_GET['mypool']) && isset($_GET['soil_all']) && $ku['fishfooder']>0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pool` WHERE `id_user` = '$ku[id]' AND (`time_soil` = '$time' OR `time_soil` < '$time' ) AND `time`>'$time'"),0)!=0)
{
if($ku['fishfooder']>0)$proc=$ku['fishfooder']*10;	else $proc=0;
$q = mysql_query("SELECT * FROM `kolhoz_pool` WHERE `id_user` = '$ku[id]' AND (`time_soil` = '$time' OR `time_soil` < '$time' ) AND `time`>'$time'");
$orat=0;
While($ground=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_pool_plant` WHERE `id` = '".intval($ground['id_fish'])."'"));

$rat=$plant['soil_rating'];
$rat_fishfooder_act=0;

if($proc>0)$rat_fishfooder_act=($rat/100)*$proc;
if($ku['labspices']>=1)$labspices=($rat/100)*($ku['labspices']*10); 
if($ku['talent_5']>=1)$talent_51=($rat/100)*($ku['talent_5']*15); 

$rat=double_exp(base_exp($rat)+$rat_fishfooder_act+$labspices+$talent_51);
$orat = $orat + $rat;
mysql_query("UPDATE `kolhoz_pool` SET `time_soil` = '".($plant['time_soil']*$incubator_timesoil_act+$time)."', `time` = '".($ground['time']-$plant['time_soil_minus'])."' WHERE `id` = '$ground[id]' LIMIT 1")or die (mysql_error());
}
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$orat)."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$orat;
update_mc($orat);
header("Location:/mypool/".passgen());
exit;
}
?>