<?
if(isset($_GET['mypetfarm']) && isset($_GET['change_food']))
{
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'])."'"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `kolhoz_user` SET `last_food` = '$plant[id]' WHERE `id` = '$ku[id]'");
header("Location:/mypetfarm/".passgen());
exit;
}
$q=mysql_query("SELECT * FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `arena` = '0' AND `fish`='0'");
while($post=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"));
echo "<li><img width='16' height='16' src='images/icons/plate.png' alt='o'> <a href='/mypetfarm/change_food/select-$post[id_plant]'>Выбрать</a> <span class='title'>".hsc($plant['name'])."</span> (<span>$post[count]</span> шт.)</li>";
}
echo "</ul></div>";
include_once 'inc/foot.php';
}

?>