Вход Регистрация
Файл: vfermu.ru/sys/myfarm/harvest_all.php
Строк: 84
<?
if(isset($_GET['myfarm']) && isset($_GET['harvest_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `farm_ground` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_plant` != '0'"),0)!=&& $ku['harvester']>0)
{
$q=mysql_query("SELECT * FROM `farm_ground` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_plant` != '0'");
$ohv=0;
$expa=0;
while(
$post=mysql_fetch_array($q))
{
$qq=mysql_query("SELECT * FROM `farm_zadanie` WHERE `id_user` = '$ku[id]' AND `id_zadanie` = '1'");
while(
$poster=mysql_fetch_array($qq))
{
if(
$poster['kol_user_nado']!=$poster['kol_user'])
{
mysql_query("UPDATE `farm_zadanie` SET `kol_user` = '".($poster['kol_user']+1)."' WHERE `id_user` = '$ku[id]' AND `id_zadanie` = '1' LIMIT 1");
}
}
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `farm_plant` WHERE `id` = '$post[id_plant]'"));
if(
$plant['id']==$gos['id_plant'] && $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("UPDATE `farm_collective` SET `rating_gos` = '$mc[rating_gos]'+'$exp' WHERE `id`='$mc[id]'");
//mysql_query("UPDATE `farm_collective_user` SET `rating_gos` = '$mcu[rating_gos]'+'$exp' WHERE `id_user`='$ku[id]'");
$expa=$expa+$exp;
}
$count=$plant['count'];
$count_harvester_act=0;
$count_yastreb_act=0;
$count_mtz_act=0;
$count_greenhouse_act=0;
if(isset(
$mtz_act))$count_mtz_act=(($count/100)*500);
if(isset(
$harvester_act))$count_harvester_act=floor(($count/100)*$harvester_act);
if(isset(
$yastreb_act))$count_yastreb_act=(($count/100)*300);
if(isset(
$greenhouse_act))$count_greenhouse_act=(($count/100)*$greenhouse_ps);
$count=$count_harvester_act+$count_mtz_act+$count_yastreb_act+$count+$count_greenhouse_act;
$count=floor($count);
if(
$pw=mysql_fetch_array(mysql_query("SELECT * FROM `farm_warehouse` WHERE `id_user` = '$ku[id]' AND `id_plant` = '$plant[id]' AND `arena` = '0'")))
{
mysql_query("UPDATE `farm_warehouse` SET `count` = '".($pw['count']+$count)."' WHERE `id` = '$pw[id]'");
}
else 
mysql_query("INSERT INTO `farm_warehouse` SET `id_plant` = '$plant[id]', `id_user`  = '$ku[id]', `count` = '$count', `arena` = '0'");
//mysql_query("UPDATE `farm_ground` SET `id_plant` = '0', `soil` = '0', `cultivator` = '0' WHERE `id` = '$post[id]' LIMIT 1");



$ohv=$ohv+$count;
}

$lab=mysql_fetch_array(mysql_query("SELECT * FROM `farm_lab_collective_vivod` WHERE `id_collective` = '$mc[id]'"));
$oder=$lab['sobrano_plant']/$plant['time']*2;
if(
$oder<100)
{
if(
$mc['id']==$lab['id_collective'])
{
if(
$plant['id']==$lab['id_plant'])
{
mysql_query("UPDATE `farm_lab_collective_vivod` SET `sobrano_plant` = '".($lab['sobrano_plant']+$ohv)."' WHERE `id_collective` = '$mc[id]'");
}
}
}
$_SESSION['harvest']=$ohv;
mysql_query("UPDATE `farm_user` SET `warehouse_count` = '".($ku['warehouse_count']+$ohv)."' WHERE `id` = '$ku[id]'");

if(
$expa>0){
mysql_query("UPDATE `farm_collective` SET `rating_gos` = '$mc[rating_gos]'+'$expa' WHERE `id`='$mc[id]'");
mysql_query("UPDATE `farm_collective_user` SET `rating_gos` = '$mcu[rating_gos]'+'$expa' WHERE `id_user`='$ku[id]'");
}
mysql_query("UPDATE `farm_ground` SET `id_plant` = '0', `soil` = '0', `cultivator` = '0' WHERE  `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_plant` != '0'");

mysql_query("UPDATE `farm_user` SET `sadovod` = '".($ku['sadovod']+$ohv)."' WHERE `id` = '$ku[id]'");
header("Location:/myfarm/".passgen());
exit;
}
?>
Онлайн: 2
Реклама