<?php
$t = 'Пополнение баланса';
require_once '../../wcore/core.php';
require_once '../../wcore/head.php';

iank();

if (isset($_POST['wcore']))
{
	$amount = abs(intval(antixs($_POST['amount'])));
	
	if (empty($amount))
	{
		echo msg_err('err', $lang['empty_amount']);
		require_once '../../wcore/foot.php';
		exit;
	}
	else
	{
		mysqli_query($mysqli, "INSERT INTO `bill_pays` (`amount`, `user_id`, `time`) VALUES ('".$amount."', '".$_SESSION['user_id']."', '".time()."')");
		
		echo $twig->render(
			'pages_modules_pays_list.tpl', [
				'bill'      => [
					'id'        => mysqli_insert_id($mysqli),
					'amount'    => $amount,
					'base64'    => base64_encode('Оплата услуг')
				],
				'bc' => kassa_config,
				'lang' => $lang,
			]
		);
		require_once '../../wcore/foot.php';
		exit;
	}
}
else
{
	echo $twig->render(
		'pages_modules_pays.tpl', array(
			'lang' => $lang
		)
	);
}
require_once '../../wcore/foot.php';
