<?

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