<?
if(isset($_GET['ozero']) && isset($_GET['spond_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pond` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0' AND (`time` = '$time' OR `time` < '$time') AND `cultivator` = '0'"),0)!=0 && $ku['sponder']>0)
{
if($ku['level']>=1 and $ku['level']<=9)$rat=1;
else if($ku['level']>=10 and $ku['level']<=19)$rat=5;
else if($ku['level']>=20 and $ku['level']<=39)$rat=50;
else if($ku['level']>=40 and $ku['level']<=49)$rat=500;
else if($ku['level']>=50 and $ku['level']<=60)$rat=5000;
else if($ku['level']>=61 and $ku['level']<=70)$rat=50000;
else $rat=10;
$rat_drakon_act=0;
$rat_sc_act=0;
$rat_dog_act=0;
$rat_lib_act=0;
$rat_cultivator_act=0;
$arena_rat=0;
if(isset($sc_act))$rat_sc_act=$rat*2;
if(isset($dog_type))$rat_dog_act=(($rat/100)*$dog_type);
if(isset($sponder_act))$rat_cultivator_act=(($rat/100)*$sponder_act);
if(isset($drakon_act))$rat_drakon_act=((2/100)*300);
if(isset($lib_act))$rat_lib_act=$rat/2;
if(isset($shmel_act))$rat_cultivator_act=$rat_cultivator_act*2;
if($ku['arena_rating']>1000){$arena_rat=floor(($rat/100)*(($ku['arena_rating']-1000)/20));}
$ratt=$rat_drakon_act+$rat_sc_act+$rat_cultivator_act+$rat_lib_act+$rat_dog_act+$arena_rat;
if($ratt==0)$rat=$rat;
else $rat=$ratt;
if(isset($dexp) AND !isset($dexp3))$rat=$rat*2; elseif(isset($dexp3))$rat=$rat*3;
$orat=0;
$q=mysql_query("SELECT * FROM `kolhoz_pond` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0' AND (`time` = '$time' OR `time` < '$time') AND `cultivator` = '0'");
while($post=mysql_fetch_array($q))
{
mysql_query("UPDATE `kolhoz_pond` SET `cultivator` = '1' WHERE `id` = '$post[id]' LIMIT 1");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
$orat=$rat+$orat;
}
$_SESSION['rating']=$orat;
update_mc($orat);
header("Location:/ozero/".passgen());
exit;
}
?>