Вход Регистрация
Файл: ferma/inc/food.php
Строк: 55
<?
if(isset($_GET['mypetfarm']) && 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'"),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]'"));
$max_time=$time+$petground['level']*(3600*4);
$mezh_time=$max_time-$petground['time'];
$nt=4*3600;
if(
$mezh_time>=$nt)
{
echo 
"<div class='event'><h1>Амбар</h1></div>";
echo 
"<div class='content'><div class='block'><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)*$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(isset(
$shmel_act))$rat_fooder_act=$rat_fooder_act*2;
$ratt=$rat_fooder_act+$rat_sc_act+$rat_drakon_act+$rat_school_act+$rat_vet_act+$rat_lib_act;
if(
$ratt==0)$rat=$rat;
else 
$rat=$ratt;
if(isset(
$dexp))$rat=$rat*2;

$korm_time=($petground['time']<$time?$time+(4*3600):$petground['time']+(4*3600));
mysql_query("UPDATE `kolhoz_petground` SET `time` = '$korm_time' WHERE `id` = '$petground[id]' LIMIT 1");
mysql_query("UPDATE `kolhoz_warehouse` SET `count` = '".($wh['count']-3)."' WHERE `id` = '$wh[id]' LIMIT 1");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$rat;

update_mc($rat);


header("Location:?mypetfarm&".passgen());
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` = '0'");
while(
$post=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"));
echo 
"<li><img width='16' height='16' src='i/icons/plate.png' alt='o'> <a href='?mypetfarm&food=$petground[id]&select=$post[id]'>Кормить</a> <span class='title'>".hsc($plant['name'])."</span> (<span>$post[count]</span> шт.)</li>";
}
echo 
"</ul></div>";
include_once 
'inc/foot.php';
}
}
?>
Онлайн: 1
Реклама