<?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();
        }
    }
    



       if($row['kyc_status'] == "pending" )


{
   header("Location:kyc.php");
   exit();


}
    if($row['code_level'] != "nothing"){

if($row['lock_status'] == "active" )


{
   header("Location:auth.php");
   exit();


}
else{
    
}



}
else{
    
}
    



?>
<!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 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'?>

                <!-- main header @e --> <div class="nk-content nk-content-fluid">
    <div class="card card-bordered">
               <div class="card-header font-weight-bold text-light" style="background-color:#033d75;">Security Setting</div>
          <div class="card-inner">
        <h5 class="card-title">Reset/Change your  <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>   account password*</h5>
        <hr>
        <form action="" method="post" class="buysell-form" ><?= csrf_field() ?>
          <!-- .buysell-field -->
           <div class="buysell-field form-group row">
             <div class="col-lg-12 col-sm-12 p-2">
             <div class="form-group">
               <div class="form-control-wrap">
                <div class="form-icon form-icon-right">
                  <em class="icon ni ni-lock-fill"></em>
                </div>
               <input type="password" class="form-control form-control-xl form-control-outlined" id="cpassword" name="cpassword">
              <label class="form-label-outlined" for="outlined-right-icon">Current Password</label>
             </div>
             </div>
          </div>
           <div class="col-lg-6 col-sm-6 p-2">
             <div class="form-group">
               <div class="form-control-wrap">
                <div class="form-icon form-icon-right">
                  <em class="icon ni ni-security"></em>
                </div>
               <input type="password" class="form-control form-control-xl form-control-outlined"  id="npassword" name="npassword">
              <label class="form-label-outlined" for="outlined-right-icon">New password</label>
             </div>
             </div>
          </div>
           <div class="col-lg-6 col-sm-6 p-2">
             <div class="form-group">
               <div class="form-control-wrap">
                <div class="form-icon form-icon-right">
                  <em class="icon ni ni-security"></em>
                </div>
               <input type="password" class="form-control form-control-xl form-control-outlined"  id="cnpassword" name="cnpassword">
              <label class="form-label-outlined" for="outlined-right-icon">Confirm New Password</label>
             </div>
             </div>
          </div>
          <div class="cardResult"></div>
          <div class="col-lg-12 col-sm-12 p-2">
             <div class="form-group">
                <button class="btn btn-primary btn-block cardBtn">Reset Password</button>
             </div>
          </div>
    </div>
  </form>
      <!-- .buysell-form -->
    </div>
</div>
</div>

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    $('.cardBtn').click(function (e) {
        e.preventDefault();
        var cpassword = $('#cpassword').val();
        var npassword = $('#npassword').val();
        var cnpassword = $('#cnpassword').val();

        $.ajax({
            type: "POST",
            url: "../apps/user/change-password.php",
            data: {"cpassword": cpassword, "npassword": npassword, "cnpassword": cnpassword},
            success: function (response) {
                if (response.trim() === "success") {
                    Swal.fire({
                        icon: 'success',
                        title: 'Password Changed',
                        text: 'Your password has been updated successfully.',
                        showConfirmButton: false,
                        timer: 2000
                    });
                    setTimeout(function() { location.reload(); }, 2200); // Reload page or redirect
                } else {
                    Swal.fire({
                        icon: 'error',
                        title: 'Error',
                        text: response,
                        showConfirmButton: true
                    });
                }
            }
        });
    });
});


</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>