Файл: zfarm.mobi/inc/farm/soil_all.php
Строк: 80
<?
$title="Выбор удобрения";
include_once '../system/config.php';
if(isset($_GET['soil_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'"),0)!=0 && $ku['soiler']>0)
{
echo"<div class='rzd2'></div><div class='menuin2'>";
echo '<div class="title">Магазин удобрений</h2></div>';
echo "<div class='content'>";
echo "<div class='div'>";
if($ku['last_soil']!=0)
{
$soil=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_soil` WHERE `id` = '$ku[last_soil]'"));
$cg=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'"),0);
if($soil['rub']){
$z="rubies";
}else{
$z="money";
}
$sc=$cg*$soil['cena'];
if($ku[$z]>=$sc)
{
$rat=$soil['rating'];
$rat_sc_act=0;
$rat_hp_act=0;
$rat_mc_hp_act=0;
$rat_drakon_act=0;
$rat_soiler_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($hp_act))$rat_hp_act=(($rat/100)*$hp_ps);
if(isset($mc_hp_act))$rat_mc_hp_act=(($rat/100)*$mc_hp_ps);
if(isset($sc_act))$rat_sc_act=$rat*2;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($soiler_act))$rat_soiler_act=(($rat/100)*$soiler_act);
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($shmel_act))$rat_soiler_act=$rat_soiler_act*2;
if(isset($shmel_act))$rat_hp_act=$rat_hp_act*2;
$ratt=$rat_mc_hp_act+$rat_sc_act+$rat_hp_act+$rat_drakon_act+$rat_medal+$rat_soiler_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;
$st=$soil['time'];
$st_hp_act=0;
$st_mc_hp_act=0;
$st_soiler_act=0;
if(isset($hp_act))$st_hp_act=($st/100)*$hp_ps;
if(isset($mc_hp_act))$st_mc_hp_act=($st/100)*$mc_hp_ps;
if(isset($soiler_act))$st_soiler_act=($st/100)*$soiler_act;
$st=$st_hp_act+$st_soiler_act+$st+$st_mc_hp_act;
$q=mysql_query("SELECT * FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'");
$orat=0;
$vc=0;
while($post=mysql_fetch_array($q))
{
$orat=($orat+$rat);
mysql_query("UPDATE `kolhoz_ground` SET `time` = '".($post['time']-$st)."', `soil` = '1' WHERE `id` = '$post[id]' LIMIT 1");
$vc=$vc+1;
}
mysql_query("UPDATE `kolhoz_user` SET `agronom` = '".($ku['agronom']+$vc)."' WHERE `id` = '$ku[id]'");
if($soil[rub]){
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$sc)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '-', `many` = '$sс', `kuda` = 'покупка удобрения', `time` = '$time'");
}else{
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-$sc)."' WHERE `id` = '$ku[id]'");
}
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$orat)."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$orat;
update_mc($orat);
}
else
{
if($soil[rub]){
no_money($soil['cena']-$ku['rubies'],$soil[rub]);
}else{
no_money($soil['cena']-$ku['money'],$soil[rub]);
}
}
header("Location:?myfarm&".passgen());
exit;
}
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_soil` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
mysql_query("UPDATE `kolhoz_user` SET `last_soil` = '".intval($_GET['select'])."' WHERE `id` = '$ku[id]'");
header("Location:?myfarm&soil_all");
exit;
}
echo "<h3>Выбери Удобрение</h3>";
$q=mysql_query("SELECT * FROM `kolhoz_soil`");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
if($post['rub']==0){$img="money";}else{$img="ruby";}
echo "<li style='padding-bottom:8px'>";
echo "<img width='48' height='48' src='/img/soils/$post[id].png' alt='o' class='portrait'><div>".($ku['level']>=$post['level']?"<a href='/garden/soilall/select/$post[id]'>":null)."<span>".hsc($post['name'])."</span>".($ku['level']>=$post['level']?"</a>":null)."<span class='minor'>, ".($ku['level']>=$post['level']?"цена: </span><span><img src='/img/icons/$img.png' alt='o'><span class='n'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div><div class='minor small'>Ускоряет рост на <span class='n'>".time_left($post['time'])."</span>,опыт: <img src='/img/icons/experience.png' alt='o'> <span class='n'>$post[rating]</span></div><div style='clear:both'></div></li>";
}
echo "</ul></div>";
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
}
?>