<?
   $count1=6;
   $t=microtime(1);
   $time=time();
require_once'/var/www/test/data/www/vferme.com/inc/start_sess.php';
$user_select=mysql_query("SELECT `id` FROM `kolhoz_user` WHERE `semen_time` > '$time'");
WHILE($ku=mysql_fetch_array($user_select)){

$ku=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$ku[id]'"));
///ТЕХНИКА///
if($ku['flowerbed']>0)
{
$fb=$ku['flowerbed'];
if($fb<=6)$flowerbed_act=$fb;
elseif($fb==7)$flowerbed_act=8;
elseif($fb==8)$flowerbed_act=10;
elseif($fb==9)$flowerbed_act=13;
elseif($fb==10)$flowerbed_act=17;
elseif($fb==11)$flowerbed_act=22;
elseif($fb==12)$flowerbed_act=28;
}

$count1=floor($ku['dostig']/5)+$count1;
if(isset($flowerbed_act))$count1=$count1+$flowerbed_act;

   $time_rub=floor(86400/$count1);
   $time1=$time-$ku['time_obmen'];
   $col_rub=floor($time1/$time_rub);
         if($col_rub>$count1)$col_rub=$count1;


$need_mcr=1000*$col_rub;
if($ku['money']>=$need_mcr)
{
if($col_rub>=$count1)
{
mysql_query("UPDATE `kolhoz_user` SET `time_obmen` = '$time', `rubies` = '".($ku['rubies']+$col_rub)."', `money` = '".($ku['money']-$need_mcr)."' WHERE `id` = '$ku[id]'");
}
else mysql_query("UPDATE `kolhoz_user` SET `time_obmen` = '".($ku['time_obmen']+($col_rub*$time_rub))."', `rubies` = '".($ku['rubies']+$col_rub)."', `money` = '".($ku['money']-$need_mcr)."' WHERE `id` = '$ku[id]'");
}


}
//////////////////////////////////////Госзаказы////////////////////////////////////////////
require_once'/var/www/test/data/www/vferme.com/inc/gos_start.php';
echo '<br/> '.number_format(microtime(1)-$t,3).' сек.';

?>