<?
if(isset($_GET['myprud']) && isset($_GET['money_all']) && $ku['autocrane']>0)
{
$q=mysql_query("SELECT * FROM `kolhoz_prud` WHERE `id_user` = '$ku[id]' AND `id_fish` != '0'");
$money2=0;
while($post=mysql_fetch_array($q))
{
$fish=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_fish` WHERE `id` = '$post[id_fish]'"));
$d_money=floor($post['time_money2']/(4*3600));
if($d_money>0)
{
$nt=$post['time_money2']-($d_money*14400);
$count=1;
$count_autocrane_act=0;
if(isset($autocrane_act))$count_autocrane_act=($count/100)*$autocrane_act;
$count=$count_autocrane_act+$count;
$money=($count*$fish['money'])*$d_money;
$money2=$money2+$money;
}
mysql_query("UPDATE `kolhoz_prud` SET `time_money` = '$time', `time_money2` = '$nt', `last_rf` = '$time' WHERE `id` = '$post[id]' LIMIT 1");
}
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money2)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `umoney` = '$money2' WHERE `id` = '$ku[id]'");
if(isset($mc) && $mc['nalog']>0)
{
$nmoney=floor(($money2/100)*$mc['nalog']);
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money2-$nmoney)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_collective` SET `money` = '".($mc['money']+$nmoney)."' WHERE `id` = '$mc[id]'");
}
header("Location:?myprud&".passgen());
exit;
}
?>