<?
if(isset($_GET['mygarden']) && isset($_GET['sbor']) && intval($_GET['sbor'])!=NULL && mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_sad` WHERE `id` = '".intval($_GET['sbor'])."' AND `id_user` = '$ku[id]' AND `id_tree` != '0'"),0)!=0)
{
$sad=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_sad` WHERE `id` = '".intval($_GET['sbor'])."' AND `id_user` = '$ku[id]' AND `id_tree` != '0'"));
$tree=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_tree` WHERE `id` = '$sad[id_tree]'"));
if($sad['time']<=$time)
{
if($tree['id']==$gos['id_tree'] && isset($mc))
{
$harv=(isset($harvester2_act)?$harvester2_act/100:0);
$hawk=(isset($yastreb2_act)?3:0);
$exp=$tree['time_soil2']+($tree['time_soil2']*$harv)+($tree['time_soil2']*$hawk);
if($gos['type']=='harvest2')$exp=$exp*2;
mysql_querll("INSERT INTO `kolhoz_collective_rating_gos` SET `id_user` = '$ku[id]', `id_collective` = '$mc[id]', `count` = '$exp', `time` = '$time'");
}
$count=$tree['count'];
$count=$count_harvester2_act+$count_yastreb2_act+$count+$count_greenhouse_act;
$money=($count*$tree['money']);
mysql_querll("UPDATE `kolhoz_sad` SET `id_tree` = '0', `soil` = '0', `plug` = '0' WHERE `id` = '".intval($_GET['sbor'])."' LIMIT 1");
{
}
$_SESSION['mon']=$money;
mysql_querll("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_sad` SET `id_tree` = '0', `soil` = '0', `plug` = '0' WHERE `id` = '".intval($_GET['sbor'])."' LIMIT 1");
header("Location:?mygarden&".passgen());
}
else header("Location:?mygarden&".passgen());
exit;
}
?>