<?

if(isset($_GET['mypool']) && isset($_GET['change_fish']))
{
require_header ('Пруды');
echo "<div class='content'>";
echo "<div class='block'>";
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pool_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_pool_plant` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `kolhoz_user` SET `last_pool` = '$plant[id]' WHERE `id` = '$ku[id]'");
header("Location:/mypool/".passgen());
exit;
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pool_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'];
$q=mysql_query("SELECT * FROM `kolhoz_pool_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 "<img width='48' height='48' src='images/fish/pool/$post[id].png' alt='*' class='portrait'>";
echo "".($ku['level']>=$post['level']?"<a href='/mypool/change_fish/select-$post[id]'>$post[name]</a>":"<span class='title'>$post[name]</span>")." ".($ku['level']>=$post['level']?"<span class='minor'>цена: </span><span><img width='16' height='16' src='images/icons/".(!empty($post['rcena'])?"ruby.png":"money.png")."' alt='*'><span class='title'>".(!empty($post['rcena'])?"$post[rcena]":"$post[mcena]")."</span></span>":"<span class='minor'>доступно с $post[level] уровня</span>")."<br/><span 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='*'> <span>$post[dohod]</span>, Опыт за кормление: <img width='16' height='16' src='images/icons/experience.png' alt='*'> <span>$post[soil_rating]</span>, Опыт за выращивание: <img width='16' height='16' src='images/icons/experience.png' alt='*'> <span>$post[rating]</span></span></li>";
}
echo "</ul>";
if ($k_page>1)new_str("mypool/change_fish/",$k_page,$page); // Вывод страниц
echo "</div>";
include_once 'inc/foot.php';
}

?>
