<?php
include('../inc/conf.php');
ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
session_set_cookie_params(604800000, "/", SITE, false, false);
session_start();
if (!isset($_SESSION["uid"])){
echo "Вы не авторизованы";
exit;
}
if(isset($_POST['sum'])){
if(!empty($_POST['sum'])){
$sum = preg_replace("#[^0-9\.]+#i",'',mysqli_real_escape_string($connect_db, trim($_POST['sum'])));
$usr = intval($_SESSION["uid"]);
$u_login = mysqli_real_escape_string($connect_db, $_SESSION['login']);
$m_shop = $p_shop_id;
$m_key = $p_key;
$dt = time();
$m_orderid = $usr.'_'.$dt;
$m_amount = number_format($sum, 2, '.', '');
$m_curr = 'RUB';
$m_desc = base64_encode("Пополнение баланса $u_login");
$arHash = array(
$m_shop,
$m_orderid,
$m_amount,
$m_curr,
$m_desc,
$m_key
);
$sign = strtoupper(hash('sha256', implode(':', $arHash)));
mysqli_query($connect_db, "INSERT INTO `t_ca` (ty,usr,sum,ba,st,dt) VALUES ('1','$usr','$m_amount','$m_orderid','0','$dt')");
echo '
<table border=0 width="100%" height="100%">
<tr width="100%" height="100%"><td width="100%" height="100%" align="center" valign="middle">
Переход к оплате...
<form id="send" method="GET" action="https://payeer.com/merchant/" style="display:none">
<input type="hidden" name="m_shop" value="'.$m_shop.'">
<input type="hidden" name="m_orderid" value="'.$m_orderid.'">
<input type="hidden" name="m_amount" value="'.$m_amount.'">
<input type="hidden" name="m_curr" value="'.$m_curr.'">
<input type="hidden" name="m_desc" value="'.$m_desc.'">
<input type="hidden" name="m_sign" value="'.$sign.'">
<input type="submit" name="m_process" value="send" />
</form>
<script type="text/javascript">
document.forms["send"].submit();
</script>
</td></tr></table>
';
} else { echo 'Вы не ввели сумму платежа'; }
} else { echo 'Ошибка'; }
?>