Файл: nm/success.php
Строк: 27
<?php
/*
* Автор: Евгений
* http://bymas.ru/id17706
* Обработчик платежей http://nicmas.ru для StrongCMS 1.0 Stable
*/
require ('config.php');
require ('../system/core.php');
$id = abs(intval($_POST['MNM_PAY_ID']));
$date = htmlspecialchars($_POST['MNM_DATE_PAY']);
$var = htmlspecialchars($_POST['MNM_VAR']);
$price = abs(intval($_POST['MNM_PRICE']));
$platform = abs(intval($_POST['MNM_PLATFORM']));
$com = htmlspecialchars($_POST['MNM_COM']);
if(!isset($id) || !isset($date) || !isset($var) || !isset($price) || !isset($platform)){
header('Location: /nm/error.php');
exit;
}
$sql = $db->query("SELECT * FROM `nicmas` WHERE `id` = '".$id."'")->num_rows;
///Проверяем key
$key = file_get_contents('http://nicmas.ru/payment/hash.aspx?summa='.$price.'&platform='.$config['platform'].'&key='.$config['key']);
///Проверяем платеж
if(mb_strlen($key) != 4){
header('Location: /nm/result.php');
exit;
}
if($sql == 0){
$db->query("INSERT INTO `nicmas` (`id`,`date`,`summa`,`com`) VALUES ('.$id.','.$date.','.$price.','.$com.')");
$db->query("UPDATE `users` SET `money` = `money` + '".$price."' WHERE `id` = '".$user['id']."'");
header('Location: /nm/result.php');
exit;
}else{
header('Location: /nm/error.php');
exit;
}
?>