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