<?
if(isset($_GET['f_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_querll("SELECT COUNT(*) FROM `kolhoz_fish` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_fish` WHERE `id` = '".intval($_GET['select'])."'"));

mysql_querll("UPDATE `kolhoz_user` SET `last_plant_f` = '$plant[id]' WHERE `id` = '$ku[id]'");
header("Location:?f_myfarm&".passgen());
exit;
}
$k_post = mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_fish`"),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_fish` 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/fish/$post[id].png' alt='o' class='portrait'>";
echo "<div class='small'>";
echo "".($ku['level']>=$post['level']?"<a href='?f_myfarm&change_plant&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>, Время до подкормки: <span class='title'>".time_left($post['time_soil'])."</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("?f_myfarm&change_plant&",$k_page,$page); // Вывод страниц
//echo "</div>";
include_once 'inc/foot.php';
}
?>