Файл: KOSMOS/inc/seat_all2.php
Строк: 99
<?
if(isset($_GET['mycellar']) && isset($_GET['seat_all2']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_plant2` = '0' AND `cultivator2` = '1'"),0)!=0)
{
echo '<div class="event"><h1>Книга Рецептов</h1></div>';
echo "<div class='content'>";
echo "<div class='block'>";
if($ku['last_recipes']!=0)
{
$plant2=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_recipes` WHERE `id` = '$ku[last_recipes]'"));
$cg=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_plant2` = '0'"),0);
$mon=($plant2['cena']/100)*$seeder2_act_skid;
$money=floor($plant2['cena']-$mon);
$sc=$money*$cg;
$rat=$plant2['rating'];
$rat_sc_act=0;
$rat_drakon_act=0;
$rat_seeder2_act=0;
$rat_school_act=0;
$rat_kulinary_act=0;
$rat_lib_act=0;
if(isset($sc_act))$rat_sc_act=$rat*2;
if(isset($drakon_act))$rat_drakon_act=(($plant2['rating']/100)*300);
if(isset($seeder2_act))$rat_seeder2_act=(($rat/100)*$seeder2_act);
if(isset($school_act))$rat_school_act=$rat/2;
if(isset($kulinary_act))$rat_kulinary_act=($rat/100)*$kulinary_ps_r;
if(isset($lib_act))$rat_lib_act=$rat*2;
if(isset($shmel_act))$rat_seeder2_act=$rat_seeder2_act*2;
$ratt=$rat_drakon_act+$rat_sc_act+$rat_seeder2_act+$rat_school_act+$rat_kulinary_act+$rat_lib_act;
if($ratt==0)$rat=$rat;
else $rat=$ratt;
if(isset($dexp))$rat=$rat*2;
if($gos['id_plant2']==$plant2['id'] && $gos['type']=='rating' && isset($mc))$rat=$rat*2;
if($ku['money']>=$sc)
{
$q=mysql_query("SELECT * FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND `id_plant2` = '0' AND `cultivator2` = '1'");
$orat=0;
while($post=mysql_fetch_array($q))
{
$orat=$rat+$orat;
mysql_query("UPDATE `kolhoz_polka` SET `id_plant2` = '$plant2[id]', `time_soil2` = '".($time+$plant2['time_soil2'])."', `time_water2` = '".($time+120)."', `soil2` = '0', `time` = '".($plant2['time']+$time)."' WHERE `id` = '$post[id]' LIMIT 1");
}
$en=0.20;
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-$sc)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$orat)."' , `energi` = '".($ku['energi']-$en)."' WHERE `id` = '$ku[id]'");
update_mc($orat);
$_SESSION['rating']=$orat;
}
else
{
$_SESSION['no_money']=$sc-$ku['money'];
}
header("Location:?mycellar&".passgen());
exit;
}
else
{
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_recipes` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
$plant2=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_recipes` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `kolhoz_user` SET `last_recipes` = '$plant2[id]' WHERE `id` = '$ku[id]'");
header("Location:?mycellar&seat_all2");
exit;
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_recipes`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_recipes` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:8px'>";
echo "<img width='48' height='48' src='images/polka/$post[image].png' alt='o' class='portrait'>";
echo "<div class='small'>";
echo "".($ku['level']>=$post['level']?"<a href='?mycellar&seat_all2&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 width='16' height='16' src='images/icons/money.png' alt='o'><span class='title'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div><div class='small minor'> Время готовки: <span class='title'>".time_left($post['time'])."</span><br>Доход: <img width='16' height='16' src='images/icons/money.png' alt='o'> <span>$post[money]</span>,
Опыт: <img width='16' height='16' src='images/icons/experience.png' alt='o'> <span>$post[rating]</span>,
Количество: <span>$post[count]</span> <span>банка</span></div></li>";
}
echo "</ul>";
if ($k_page>1)str("?mycellar&seat_all2&",$k_page,$page); // Вывод страниц
}
echo "</div>";
include_once 'inc/foot.php';
}
?>