<?
if(isset($_GET['mygarden']) && isset($_GET['sbor_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_sad` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_tree` != '0'"),0)!=0)
{
$q=mysql_query("SELECT * FROM `kolhoz_sad` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_tree` != '0'");
$ohv=0;
while($post=mysql_fetch_array($q))
{
$tree=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_tree` WHERE `id` = '$post[id_tree]'"));
if($tree['id']==$gos['id_tree'] && $mc)
{
$harv=(isset($harvester2_act)?$harvester2_act/100:0);
$hawk=(isset($yastreb2_act)?3:0);
$exp=$tree['time_soil']+($tree['time_soil']*$harv)+($tree['time_soil']*$hawk);
if($gos['type']=='harvest2')$exp=$exp*2;
mysql_query("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=($ohv*$tree['money']);
mysql_query("UPDATE `kolhoz_sad` SET `id_tree` = '0', `soil` = '0', `plug` = '0' WHERE `id` = '".intval($_GET['sbor_all'])."' LIMIT 1");
{
}
mysql_query("UPDATE `kolhoz_sad` SET `id_tree` = '0', `soil` = '0', `plug` = '0' WHERE `id` = '$post[id]' LIMIT 1");
$ohv=$ohv+$count;
}
$_SESSION['mon']=$money;
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_sad` SET `id_tree` = '0', `soil` = '0', `plug` = '0' WHERE `id` = '".intval($_GET['sbor_all'])."' LIMIT 1");
header("Location:?mygarden&".passgen());
exit;
}
?>