Файл: payment/pay/freekassa/index.php
Строк: 29
<?php
require ($_SERVER['DOCUMENT_ROOT'].'/core/sys.php');
$id = abs(intval($_POST['pay']));
$summa = abs($_POST['MNM_PRICE']);
$time = abs(intval($_POST['MNM_TIME_PAY']));
$pay = $db->prepare('SELECT * FROM `pay` WHERE `id` = ?');
$pay -> execute([$id]);
$pay = $pay -> fetch(PDO :: FETCH_ASSOC);
if(!isset($pay['id']) || $pay['status'] == 'yes'){
header('Location: '.$client['url']);
exit;
}
if(!is_numeric($summa)){
header('Location: '.$client['url']);
exit;
}
if($pay['type'] == 0){
header('Location: '.$client['url']);
exit;
}
$client = $db->prepare('SELECT * FROM `platform` WHERE `id` = ?');
$client -> execute([$pay['platform']]);
$client = $client -> fetch(PDO :: FETCH_ASSOC);
if(!isset($client['id'])){
header('Location: /');
exit;
}
$hash = md5($client['key']);
if($hash != $pay['hash']){
header('Location: '.$client['error']);
exit;
}
if($pay['check'] != md5($summa.$pay['platform'].
$time)){
header('Location: '.$client['error']);
exit;
}
define ('fk_id', '190288'); # fk_id - ID мазагина в free-kassa.ru http://free-kassa.ru/merchant/cabinet/help/
define ('fk_key', 'tr8z72h9'); # fk_key - Секретное слово http://free-kassa.ru/merchant/cabinet/profile/tech.php
#Записываем SESSION
$_SESSION['freekassa'] = $id;
# кидаем на кассу
$m = '?m='.fk_id; # id
$s = '&s='.md5(fk_id.':'.$summa.':'.fk_key.':'.$id); # подпись
$oa = '&oa='.$summa; # сумма заказа
$o = '&o='.$id; # номер заказа
$url = "http://www.free-kassa.ru/merchant/cash.php{$m}{$s}{$oa}{$o}";
header("Location: {$url}");
exit;
?>