<?
if(isset($_GET['new_sad']) && isset($_GET['ok']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_sad` WHERE `id_user` = '$ku[id]'"),0)<20)
{
$cena=cpg(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_sad` WHERE `id_user` = '$ku[id]'"),0));
if($ku['rubies']>=$cena)
{
mysql_query("INSERT INTO `kolhoz_sad` SET `id_user` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
}
else
{
$rm=$cena-$ku['rubies'];
$_SESSION['no_rubies']=$rm;
}
header("Location:?mygarden");
}
elseif(isset($_GET['new_sad']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_sad` WHERE `id_user` = '$ku[id]'"),0)<20)
{
echo '<div class="event"><h1>Подтверждение</h1></div><div class="content"><div class="block"><ul class="block"><li><span class="title">Вы уверены?</span></li><li class="pt"><img alt="" width="16" height="16" src="images/icons/tick.png"> <a href="?mygarden&new_sad&ok"><span>
Да, подтверждаю</span></a></li><li><img alt="" width="16" height="16" src="images/icons/cross.png"> <a href="?mygarden"><span>
Нет, отказываюсь</span></a></li></ul></div>';
include_once 'inc/foot.php';
}
?>