Вход Регистрация
Файл: inc/petfarm/food.php
Строк: 58
<?
$title
='Кормление животного';
include_once 
'../system/config.php';
if(isset(
$_GET['food']) && intval($_GET['food'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['food'])."' AND `id_user` = '$ku[id]' AND `id_pet` != '0'  AND `time_corm` < '$time'"),0)!=0)
{
$petground=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['food'])."' AND `id_user` = '$ku[id]'"),0);
$pet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_pet` WHERE `id` = '$petground[id_pet]'"));

echo
"<div class='rzd2'></div><div class='menuin2'>";
    
echo 
"<div class='title'>Амбар</h2></div>";
echo 
"<div class='content'><div class='div'><ul>";
if(isset(
$_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_warehouse` WHERE `id` = '".intval($_GET['select'])."' AND `id_user` = '$ku[id]'"),0)!=0)
{
$wh=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_warehouse` WHERE `id` = '".intval($_GET['select'])."'"));
if(
$wh['count']>=3)
{

$rat=$pet['rating'];
$rat_fooder_act=0;
$rat_sc_act=0;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_vet_act=0;
$rat_lib_act=0;
if(isset(
$sc_act))$rat_sc_act=$rat*2;
if(isset(
$drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset(
$fooder_act))$rat_fooder_act=($rat/100)*(40+(20*$fooder_act));
if(isset(
$school_act))$rat_school_act=$rat*2;
if(isset(
$vet_act))$rat_vet_act=($rat/100)*$vet_ps_r;
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_fooder_act=$rat_fooder_act*2;
$ratt=floor($rat+$rat_fooder_act+$rat_sc_act+$rat_drakon_act+$rat_medal+$rat_school_act+$rat_vet_act+$rat_lib_act);
if(
$ratt==0)$rat=$rat;
else 
$rat=$ratt;
if(isset(
$dexp))$rat=$rat*2;
if(isset(
$exp3))$rat=$rat*3;

mysql_query("UPDATE `kolhoz_petground` SET `time_corm` = '".($time 3600)."' WHERE `id` = '$petground[id]' LIMIT 1");
mysql_query("UPDATE `kolhoz_warehouse` SET `count` = '".($wh['count']-3)."' WHERE `id` = '$wh[id]' AND `arena` = '1' LIMIT 1");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."', `last_corm` = '".intval($_GET['select'])."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$rat;

update_mc($rat);


header("Location:/barnyard");
exit;
}
else echo 
"<div style='background-color:#114411;padding:4px;border:1px solid red'>Не хватает ".(3-$wh['count'])." шт.</div>";
}
$q=mysql_query("SELECT * FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `arena` = '1'");
while(
$post=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"));
  echo 
"<li><img src='/img/icons/plate.png' alt='o'> <a href='/barnyard/food/$petground[id]/select/$post[id]'>Кормить</a> <span class='n'>".hsc($plant['name'])."</span> (<span>$post[count]</span> шт.)</li>";
}
echo 
"</ul></div>";
echo
"</div></div><div class='rzd2'></div>";

include_once 
'../system/foot.php';

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