<?
if(isset($_GET['mypetfarm']) && isset($_GET['change_food']))
{
echo "<div class='event'><h1>Амбар</h1></div>";
echo "<div class='content'><div class='block'><ul>";
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"),0)!=0)
{
$wh=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `kolhoz_user` SET `last_food` = '$wh[id]' WHERE `id` = '$ku[id]'");
header("Location:?mypetfarm&".passgen());
exit;
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
echo "<ul>";
$k_page=k_page($k_post,$pet['s_str']);
$page=page($k_page);
$start=$pet['s_str']*$page-$pet['s_str'];
$num=($page-1)*$pet['s_str'];
$q=mysql_query("SELECT * FROM `kolhoz_plant` ORDER BY `level` ASC LIMIT $start, $pet[s_str]");
while($post=mysql_fetch_array($q))
{
$num++;
echo "<li><span class='minor'>$num.</span>";
echo "<img width='16' height='16' src='images/icons/plate.png' alt='o'> <span class='title'>".hsc($post['name'])."</span> <a href='?mypetfarm&change_food&select=$post[id]'>Выбрать</a></li>";
}
echo "</ul>";
if ($k_page>1)str("?mypetfarm&change_food&",$k_page,$page); // Вывод страниц
echo "</div>";
include_once 'inc/foot.php';
}
?>