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