<?php

$post = ($_POST['LMI_PAYMENT_AMOUNT']); 

if (empty($post)) { echo 'Вали отсюда, парень'; exit; }

include 'db.php';
$num = ($_POST['LMI_PAYMENT_NO']);

$number = mysql_fetch_assoc(mysql_query("SELECT * FROM `rek` WHERE `num` = '".$num."'"));

$data = mysql_query("SELECT * FROM `rek` WHERE `num` = '".$num."'");

$row = mysql_fetch_assoc($data);


if($row['sum'] <> $post ) {

$err="ERR: Ошибка ".$_POST['LMI_PAYMENT_AMOUNT'];

echo "ERR: Ошибка ".$_POST['LMI_PAYMENT_AMOUNT'];

mysql_query("UPDATE `rek` SET `err` = '".$err."' WHERE `num` = '".$number['num']."'");
exit;
}

if(trim($_POST['LMI_PAYEE_PURSE'])!="R164504063695") {


$err="ERR: Ошибка ".$_POST['LMI_PAYEE_PURSE'];

echo "ERR: Ошибка ".$_POST['LMI_PAYEE_PURSE'];

mysql_query("UPDATE `rek` SET `err` = '".$err."' WHERE `num` = '".$number['num']."'");
exit;
}

if(empty($err)){ echo "YES";


}

IF($_POST['LMI_PREREQUEST']==1) {
}
ELSE {

$number = mysql_fetch_assoc(mysql_query("SELECT * FROM `rek` WHERE `num` = '".$num."'"));


if($number == TRUE)


{

mysql_query("UPDATE `rek` SET `ok` = '1', `srok` = '1'  WHERE `num` = '".$number['num']."'");

}


}
?>
