<?
if(isset($_GET['sell']) && intval($_GET['sell'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_garden` WHERE `id` = '".intval($_GET['sell'])."' AND `id_user` = '$ku[id]' AND `id_pet` != '0'"),0)!=0)
{
$petground=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_garden` WHERE `id` = '".intval($_GET['sell'])."' AND `id_user` = '$ku[id]'"));
$pet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_tree` WHERE `id` = '$petground[id_pet]'"));
if(isset($_GET['ok']))
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+floor($pet['cena']/3))."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_garden` SET `id_pet` = '0' WHERE `id` = '$petground[id]'");
header("Location:/mygarden/moderate/".passgen());
exit;
}
podtv("/mygarden/ok/sell-$petground[id]","/mygarden");
include_once 'inc/foot.php';
}
?>