<?
echo "<div class='event'><h1>Покупка ресурсов</h1></div>";
echo "<div class='block'>";
if(isset($_GET['itog'])){
if ($ku['pokupka']==1){
$paymentId = $_GET['paymentId'];
$account = $_GET['account'];
$sum=mysql_result(mysql_query ("SELECT `sum` FROM `unitpay_payments` WHERE `unitpayId` = '".$paymentId."' LIMIT 1"),0);
echo "".$sum."";

mysql_query("UPDATE `kolhoz_user` SET `zkl`=`zkl`+'".$sum."' WHERE `id`='".$account."'");
mysql_query("UPDATE `kolhoz_user` SET `pokupka` = '0' WHERE `id` = '".$account."'");
}
else
echo "Данный платеж уже использован!";
include_once 'inc/foot.php';
}


$account = $_GET['account'];
mysql_query("UPDATE `kolhoz_user` SET `pokupka` = '1' WHERE `id` = '".$account."'");
echo "<a href ='?paymentId=".$paymentId."&account=".$account."&itog'>Забрать ресурсы</a>";

include_once 'inc/foot.php';
?>