<?

if(isset($_GET['mycellar']) && isset($_GET['clean_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_recipes` = '0' AND (`time` = '$time' OR `time` < '$time') AND `clean` = '0'"),0)!=0)
{
$rat=1;
$rat_drakon_act=0;
$rat_sc_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($sc_act))$rat_sc_act=$rat*2;
if(isset($drakon_act))$rat_drakon_act=((2/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat*2;
$ratt=$rat_drakon_act+$rat_sc_act+$rat_school_act+$rat_lib_act;
if($ratt==0)$rat=$rat;
else $rat=$ratt;
if(isset($dexp))$rat=$rat*2;
$orat=0;
$q=mysql_query("SELECT * FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_recipes` = '0' AND (`time` = '$time' OR `time` < '$time') AND `clean` = '0'");

while($post=mysql_fetch_array($q))
{
mysql_query("UPDATE `kolhoz_polka` SET `clean` = '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:?mycellar&".passgen());
exit;
}
?>