<?
if(isset($_GET['mycellar']) && isset($_GET['put']) && intval($_GET['put'])!=NULL && mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id` = '".intval($_GET['put'])."' AND `id_user` = '$ku[id]' AND `id_recipes` = '0' AND `clean` = '1'"),0)!=0)
{
echo '<div class="event"><h1>Книга рецептов</h1></div>';
echo "<div class='content'>";
echo "<div class='block'>";
$polka=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_polka` WHERE `id` = '".intval($_GET['put'])."' AND `id_user` = '$ku[id]'"));
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_recipes` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
$recipes=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_recipes` WHERE `id` = '".intval($_GET['select'])."'"));
if($ku['money']>=$recipes['cena'])
{
$money=$recipes['cena'];
{
}
if($gos['id_plant2']==$plant2['id'] && $gos['type']=='rating' && isset($mc))$rat=$rat*2;
mysql_querll("UPDATE `kolhoz_polka` SET `id_recipes` = '$recipes[id]', `time_soil` = '".($time+$recipes['time_soil'])."', `time_water` = '".($time+120)."', `soil` = '0', `time` = '".($recipes['time']+$time)."' WHERE `id` = '$polka[id]' LIMIT 1");
mysql_querll("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-$money)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `last_recipes` = '$recipes[id]' WHERE `id` = '$ku[id]'");
}
else
{
$nm=$recipes['cena']-$ku['money'];
$_SESSION['no_money']=$nm;
}
header("Location:?mycellar&".passgen());
exit;
}
$k_post = mysql_result(mysql_querll("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_querll("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='img/polka/$post[image].png' alt='o' class='portrait'>";
echo "<div class='small'>";
echo "".($ku['level']>=$post['level']?"<a href='?mycellar&put=$polka[id]&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='img/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='img/icons/money.png' alt='o'> <span>$post[money]</span>,
Опыт: <img width='16' height='16' src='img/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&put=$polka[id]&",$k_page,$page); // Вывод страниц
echo "</div>";
include_once 'inc/foot.php';
}
?>