Файл: vkolhoze.com/inc/change_plant.php
Строк: 133
<?
if(isset($_GET['myfarm']) && isset($_GET['change_plant']))
{
echo '<div class="event"><h1>Магазин семян</h1></div>';
echo "<div class='content'>";
echo "<div class='block'>";
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && 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:?myfarm&".passgen());
exit;
}
$go = isset($_GET['go']) ? $_GET['go'] : '';
switch($go){
default:
if(isset($mc)){echo'<div class="pb">
<img width="16" height="16" src="/images/icons/seat.png" alt="o"/> <a href="?myfarm&change_plant&go=kh">Колхозные семена</a>
</div>';}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id_collective` = '0' AND `type` = '0'"),0);
if ($k_post==0)
{
echo "".$lng['k_post']."";
}
$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_plant` WHERE `id_collective` = '0' AND `type` = '0' 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/plants/$post[id_plant].png' alt='o' class='portrait'>";
echo "<div class='small'>";
echo "".($ku['level']>=$post['level']?"<a href='?myfarm&change_plant&select=$post[id]'>":null)."<span>".hsc($post['name'])."</span></a> <span class='minor'>, ".($ku['level']>=$post['level']?"цена: </span><span><img width='16' height='16' src='/images/icons/money.png' alt='o'><span class='title'>".numbers($post['cena'])."</span></span>":"доступно с $post[level] уровня</span>")."</div><div class='small minor'> Время созревания:
<span class='title'>".time_left($post['time'])."</span>,Время до удобрения: <span class='title'>".time_left($post['time_soil'])."</span>Доход: <img width='16' height='16' src='/images/icons/money.png' alt='o'> <span>".numbers($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("?myfarm&change_plant&",$k_page,$page);
break;
case 'kh':
if(!isset($mc)){header("Location:?myfarm&".passgen());exit;}
echo'<div class="pb"><img width="16" height="16" src="/images/icons/seat.png" alt="o"/> <a href="?myfarm&change_plant">Обычные семена</a></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id_collective` = '".($mc['id'])."' AND `type` = '0'"),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_plant` WHERE `id_collective` = '".($mc['id'])."' AND `type` = '0' ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
$pl=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"));
echo "<li style='padding-bottom:8px'>";
echo "<img width='48' height='48' src='/images/".($post['id_collective']>0?"custom/":"plants/")."/$post[id_plant].png' alt='o' class='portrait'>";
echo "<div class='small'>";
echo "".($ku['level']>=$post['level']?"<a href='?myfarm&change_plant&select=$post[id]'>":null)."<span>".hsc($pl['name'])." ".hsc($post['name'])."</span></a> <span class='minor'>, ".($ku['level']>=$post['level']?"цена: </span><span><img width='16' height='16' src='/images/icons/money.png' alt='o'><span class='title'>".numbers($post['cena'])."</span></span>":"доступно с $post[level] уровня</span>")."</div><div class='small minor'> Время созревания: <span class='title'>".time_left($post['time'])."</span>, Время до удобрения: <span class='title'>".time_left($post['time_soil'])."</span><br>Доход: <img width='16' height='16' src='/images/icons/money.png' alt='o'> <span>".numbers($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("?myfarm&change_plant&go=kh&",$k_page,$page);
break;}
echo "</div>";
include_once 'inc/foot.php';
}
?>