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