Вход Регистрация
Файл: inc/farm/harvest.php
Строк: 111
<?
include_once '../system/config.php';

if(
intval($_GET['harvest'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id` = '".intval($_GET['harvest'])."' AND `id_user` = '$ku[id]' AND `id_plant` != '0'"),0)!=0)
{
$ground=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_ground` WHERE `id` = '".intval($_GET['harvest'])."' AND `id_user` = '$ku[id]' AND `id_plant` != '0'"));
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$ground[id_plant]'"));
if(
$ground['time']<=$time)
{
    if(
$plant['id']==$gos['id_plant'] && isset($mc))
    {
        
$harv=(isset($harvester_act)?$harvester_act/100:0);
        
$hawk=(isset($yastreb_act)?3:0);
        
$exp=$plant['time_soil']+($plant['time_soil']*$harv)+($plant['time_soil']*$hawk);
        if(
$gos['type']=='harvest')$exp=$exp*2;
        
mysql_query("INSERT INTO `kolhoz_collective_rating_gos` SET `id_user` = '$ku[id]', `id_collective` = '$mc[id]', `count` = '$exp', `time` = '$time'");
    }
    
$count=$plant['count'];
    
$count_harvester_act=0;
    
$count_yastreb_act=0;
    
$count_greenhouse_act=0;
    if(isset(
$harvester_act))$count_harvester_act=($count*(40+(20*$harvester_act)))/100;
    if(isset(
$yastreb_act))$count_yastreb_act=(($count/100)*300);
    if(isset(
$greenhouse_act))$count_greenhouse_act=(($count/100)*$greenhouse_ps);
    if(isset(
$expcount))$count=$count*2;

    
$count=$count_harvester_act+$count_yastreb_act+$count+$count_greenhouse_act;
    
$count=round($count);
    if(
$gos['id_plant']==$plant['id'] && $gos['type']=='harvest' && isset($mc))$count=$count*2;
    
$assUser mysql_fetch_array(mysql_query("SELECT * FROM `assignments_user` WHERE `id_user` = '$ku[id]'"));
    
$ass mysql_fetch_array(mysql_query("SELECT * FROM `assignments` WHERE `id` = '$assUser[assignment]'"));
    
    if(
$plant['id']==$ass['plant1'] && $assUser['assignment']>0)
    {
        
mysql_query("UPDATE `assignments_user` SET `plant1` = '".($assUser['plant1']+$count)."' WHERE `id_user` = '$ku[id]'");
    }
    if(
$plant['id']==$ass['plant2'] && $assUser['assignment']>0)
    {
        
mysql_query("UPDATE `assignments_user` SET `plant2` = '".($assUser['plant2']+$count)."' WHERE `id_user` = '$ku[id]'");
    }
    if(
$plant['id']==$ass['plant3'] && $assUser['assignment']>0)
    {
        
mysql_query("UPDATE `assignments_user` SET `plant3` = '".($assUser['plant3']+$count)."' WHERE `id_user` = '$ku[id]'");
    }
    if(
$pw=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `id_plant` = '$plant[id]' AND `arena` = '0'")))
    {
        
mysql_query("UPDATE `kolhoz_warehouse` SET `count` = '".($pw['count']+$count)."' WHERE `id` = '$pw[id]'");
    }
    else 
mysql_query("INSERT INTO `kolhoz_warehouse` SET `id_plant` = '$plant[id]', `id_user`  = '$ku[id]', `count` = '$count', `arena` = '0'");
    
$_SESSION['harvest']=$count;
    
mysql_query("UPDATE `kolhoz_user` SET `sadovod` = '".($ku['sadovod']+$count)."' WHERE `id` = '$ku[id]'");
    
mysql_query("UPDATE `kolhoz_ground` SET `id_plant` = '0', `soil` = '0', `cultivator` = '0' WHERE `id` = '".intval($_GET['harvest'])."' LIMIT 1");
    
header("Location:/garden?ok_garden");
}
  else 
header("Location:/garden/".passgen());
exit;
}
?>
Онлайн: 3
Реклама