<?
if(isset($_GET['ozero']) && isset($_GET['catchfish']) && intval($_GET['catchfish'])!=NULL && mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_pond` WHERE `id` = '".intval($_GET['catchfish'])."' AND `id_user` = '$ku[id]' AND `id_plant` != '0'"),0)!=0)
{
$ground=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_pond` WHERE `id` = '".intval($_GET['catchfish'])."' AND `id_user` = '$ku[id]' AND `id_plant` != '0'"));
$plant=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_fish` WHERE `id` = '$ground[id_plant]'"));
if($ground['time']<=$time)
{

$count=$plant['count'];
$count_harvester_act=0;
$count_yastreb_act=0;
$count_greenhouse_act=0;
if(isset($catchfish_act))$count_harvester_act=floor(($count/100)*$catchfish_act);
$count=$count_harvester_act+$count_yastreb_act+$count+$count_greenhouse_act;
$count=floor($count);
///до сюда
if($gos['id_plant']==$plant['id'] && $gos['type']=='harvest' && isset($mc))$count=$count*2;
if($pw=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `id_plant` = '$plant[id]' AND `arena` = '0' AND `fish` = '1'")))
{
mysql_querll("UPDATE `kolhoz_warehouse` SET `count` = '".($pw['count']+$count)."' WHERE `id` = '$pw[id]'");
}
else mysql_querll("INSERT INTO `kolhoz_warehouse` SET `id_plant` = '$plant[id]', `id_user`  = '$ku[id]', `count` = '$count', `arena` = '0', `fish` = '1'");
$_SESSION['catchfish']=$count;
mysql_querll("UPDATE `kolhoz_user` SET `ribak` = '".($ku['sadovod']+$count)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_pond` SET `id_plant` = '0', `soil` = '0', `cultivator` = '0' WHERE `id` = '".intval($_GET['catchfish'])."' LIMIT 1");
header("Location:?ozero&".passgen());
}
else header("Location:?ozero&".passgen());
exit;
}
?>