<?
if(isset($_GET['myprud']) && isset($_GET['money']) && intval($_GET['money'])!=NULL && mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_prud` WHERE `id` = '".intval($_GET['money'])."' AND `id_user` = '$ku[id]' AND `id_fish` != '0'"),0)!=0)
{
$prud=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_prud` WHERE `id` = '".intval($_GET['money'])."' AND `id_user` = '$ku[id]'"),0);
$fish=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_fish` WHERE `id` = '$prud[id_fish]'"));
$d_money=floor($prud['time_money2']/(4*3600));
if($d_money>0)
{
$nt=$prud['time_money2']-($d_money*14400);
$count=1;
$count_autocrane_act=0;
$count_vet_act=0;
if(isset($autocrane_act))$count_autocrane_act=($count/100)*$autocrane_act;
$count=$count_autocrane_act+$count;

$money=($count*$fish['money'])*$d_money;
mysql_querll("UPDATE `kolhoz_prud` SET `time_money` = '$time', `time_money2` = '$nt' WHERE `id` = '$prud[id]' LIMIT 1");
mysql_querll("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `umoney` = '$money' WHERE `id` = '$ku[id]'");
if(isset($mc) && $mc['nalog']>0)
{
$nmoney=floor(($money/100)*$mc['nalog']);
mysql_querll("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money-$nmoney)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_collective` SET `money` = '".($mc['money']+$nmoney)."' WHERE `id` = '$mc[id]'");
mysql_querll("INSERT INTO `kolhoz_collective_cash` SET `id_user` = '$ku[id]', `id_collective` = '$mc[id]', `count` = '$nmoney', `type` = 'money', `time` = '$time'");
}
}
header("Location:?myprud&".passgen());
exit;
}
?>