Вход Регистрация
Файл: KOSMOS/inc/fishfood.php
Строк: 44
<?
if(isset($_GET['myprud']) && isset($_GET['fishfood']) && intval($_GET['fishfood'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_prud` WHERE `id` = '".intval($_GET['fishfood'])."' AND `id_user` = '$ku[id]' AND `id_fish` != '0'"),0)!=0)
{
$prud=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_prud` WHERE `id` = '".intval($_GET['fishfood'])."' AND `id_user` = '$ku[id]'"),0);
$fish=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_fish` WHERE `id` = '$prud[id_fish]'"));
$max_time=$time+$prud['level']*(3600*4);
$mezh_time=$max_time-$prud['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=$fish['rating'];
$rat_fishfooder_act=0;
$rat_sc_act=0;
$rat_drakon_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=(($rat/100)*300);
if(isset(
$fishfooder_act))$rat_fishfooder_act=(($rat/100)*$fishfooder_act);
if(isset(
$school_act))$rat_school_act=$rat*2;
if(isset(
$lib_act))$rat_lib_act=$rat*2;
if(isset(
$shmel_act))$rat_fishfooder_act=$rat_fishfooder_act*2;
$ratt=$rat_fishfooder_act+$rat_sc_act+$rat_drakon_act+$rat_school_act+$rat_lib_act;
if(
$ratt==0)$rat=$rat;
else 
$rat=$ratt;
if(isset(
$dexp))$rat=$rat*2;

$korm_time=($prud['time']<$time?$time+(4*3600):$prud['time']+(4*3600));
mysql_query("UPDATE `kolhoz_prud` SET `time` = '$korm_time' WHERE `id` = '$prud[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]'");
mysql_query("UPDATE `kolhoz_user` SET `tkormer` = '".($ku['tkormer']+1)."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$rat;

update_mc($rat);


header("Location:?myprud&".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='images/icons/plate.png' alt='o'> <a href='?myprud&fishfood=$prud[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';
}
}
?>
Онлайн: 0
Реклама