Файл: inc/farm/change_plant.php
Строк: 95
<?
$title='Магазин семян';
include_once '../system/config.php';
echo"<div class='rzd2'></div><div class='menuin2'>";
echo '<div class="title">Магазин семян</h2></div>';
echo "<div class='content'>";
echo "<div class='div'>";
if(isset($_GET['change_plant']))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"));
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && $plant['dostup']<1 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `kolhoz_user` SET `last_plant` = '$plant[id]' WHERE `id` = '$ku[id]'");
header("Location:/garden/");
exit;
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant`"),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'];
$levels=$ku['level']+5;
$q=mysql_query("SELECT * FROM `kolhoz_plant` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:8px'>";
echo "<div class='small'>";
echo " <img style='border-radius: 5px' width='48' height='48' src='/img/plants/$post[img].png' alt='o' class='portrait'>";
if($ku['level']>=$post['level'] && $post['dostup']<1)echo"<br><a href='/garden/plant/select/$post[id]/'><span>".hsc($post['name'])."</a></span><span class='minor'>, цена: </span><span><img src='/img/icons/money.png' alt='o'><span class='n'>$post[cena]</span></span></span>";
if($ku['level']<=$post['level'] && $post['dostup']<1)echo"<br><span>".hsc($post['name'])."</a></span><span class='minor'>, доступно c <span class='n'>$post[level]</span></span> уровня</span>";
if($post['dostup']>0)echo"<br><span>".hsc($post['name'])."</a></span><span class='minor'>, доступно в период <span class='n'>ивентов</span></span></span>";
echo"<div class='small minor'> Время созревания:
<span class='n'>".time_left($post['time'])."</span>, Время до удобрения: <span class='n'>".time_left($post['time_soil'])."</span><br>Доход: <img src='/img/icons/money.png' alt='o'> <span>$post[money]</span>, Опыт: <img 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("/garden/plant/",$k_page,$page); // Вывод страниц
echo "</div>";
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
}
?>