Файл: inc/petfarm/sell_animal.php
Строк: 27
<?
$title='Продажа животного';
include_once '../system/config.php';
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'"),0)!=0)
{
$petground=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id` = '".intval($_GET['sell'])."' AND `id_user` = '$ku[id]'"));
$pet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_pet` WHERE `id` = '$petground[id_pet]'"));
if(isset($_GET['ok']))
{
if($pet['rub']){
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+($pet['cena']/2))."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '-', `many` = '".($pet['cena']/2)."' , `kuda` = 'продажа животного', `time` = '$time'");
}else{
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]'");
header("Location:/barnyard/moderate");
exit;
}
podtv("/barnyard/sell/$petground[id]/ok","/barnyard");
echo'</div>';
include_once '../system/foot.php';
}
?>