Вход Регистрация
Файл: cron/vnuchka.php
Строк: 75
<?php
 
define
('ROOTPATH'realpath(dirname(__FILE__)));
include_once 
__DIR__.'/connect.php';
include(
dirname(__DIR__).'/inc/system/functions.php');


$time=time();
$x=mysql_query('SELECT * FROM `kolhoz_user` WHERE `garden_vnuchka_time` >= "'.$time.'"');
while(
$ku=mysql_fetch_array($x))
{


    
$mcu=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective_user` WHERE `id_user` = '".$ku['id']."'"));
    
$mc=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective` WHERE `id` = '".$mcu['id_collective']."'"));
    include(
dirname(__DIR__).'/inc/system/tehnika.php');
    
//Продать
    
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_recipes` != '0'"),0)!=0)
    {
    
$ccl=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_recipes` != '0'"),0);
    
$q=mysql_query("SELECT * FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_recipes` != '0'");
    
$ohv=0;
    while(
$post=mysql_fetch_array($q))
    {
        
$recipes=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_recipes` WHERE `id` = '$post[id_recipes]'"));
        
$rat=$recipes['rating'];
        
$rat_sc_act=0;
        
$rat_drakon_act=0;
        
$rat_kulinary_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=(($recipes['rating']/100)*300);
        if(isset(
$school_act))$rat_school_act=$rat*2;
        if(isset(
$lib_act))$rat_lib_act=$rat*2;
        if(
$mc['MedalRating']>0)$rat_medal=(($rat/100)*($mc['MedalRating']*0.5));
        if(isset(
$kulinary_act))$rat_kulinary_act=($rat/100)*$kulinary_ps_r;
        
$ratt=floor($rat+$rat_drakon_act+$rat_medal+$rat_sc_act+$rat_kulinary_act+$rat_school_act+$rat_lib_act);
        if(
$ratt==0)$rat=$rat;
        else 
$rat=$ratt;
        if(isset(
$dexp))$rat=$rat*2;
        if(isset(
$exp3))$rat=$rat*3;
        
$money=$recipes['money'];
        
$cm=0;
        
$cm=$cm+($money*$ccl);
        
$orat=$rat+$orat;
        
$count=$recipes['count'];
        
$count=$count_harvester2_act+$count_yastreb2_act+$count+$count_greenhouse_act;
        
mysql_query("UPDATE `kolhoz_polka` SET `id_recipes` = '0', `soil` = '0', `clean` = '0' WHERE `id` = '$post[id]' LIMIT 1");
        
$ohv=$ohv+$count;
        

    }
    echo 
"$ku[nick] Продать     Rat $orat       Mon $cm<br><br><br>";
    
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$orat)."', `money` = '".($ku['money']+$cm)."' WHERE `id` = '$ku[id]'");
    
update_mc($orat);

}

    
//Очтстить
    
if( 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;
        if(
$mc['MedalRating']>0)$rat_medal=(($rat/100)*($mc['MedalRating']*0.5));
        
$ratt=floor($rat+$rat_drakon_act+$rat_medal+$rat_sc_act+$rat_school_act+$rat_lib_act);
        if(
$ratt==0)$rat=$rat;
        else 
$rat=$ratt;
        if(isset(
$dexp))$rat=$rat*2;if(isset($exp3))$rat=$rat*3;
        
$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");
            
$orat=$rat+$orat;
        }
        
update_mc($orat);
        
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$orat)."' WHERE `id` = '$ku[id]'");
        echo 
"$ku[nick] Продать     Rat $orat<br><br><br>";
    }
    
    
//Поставить
    
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_recipes` = '0' AND `clean` = '1'"),0)!=0)
    {
        if(
$ku['last_recipes']!=0)
        {
            
$recipes=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_recipes` WHERE `id` = '$ku[last_recipes]'"));
            
$cg=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_recipes` = '0'"),0);
            
$mon=($recipes['cena']/100)*$seeder2_act_skid;
            
$money=floor($recipes['cena']-$mon);
            
$sc=$money*$cg;
            
$rat_sc_act=0;
            if(
$ku['money']>=$sc)
            {
                
$q=mysql_query("SELECT * FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_recipes` = '0' AND `clean` = '1'");
                
                while(
$post=mysql_fetch_array($q))
                {
                    
mysql_query("UPDATE `kolhoz_polka` SET `id_recipes` = '$recipes[id]', `time_soil` = '".($time+$recipes['time_soil'])."', `time_water` = '".($time+120)."', `soil` = '0', `time` = '".($recipes['time']+$time)."' WHERE `id` = '$post[id]' LIMIT 1");
                }
                echo 
"$ku[nick] Продать     Mon -$sc<br><br><br>";
                
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-$sc)."' WHERE `id` = '$ku[id]'");
            }
        }
    }
    
 




?>
Онлайн: 0
Реклама