<?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" || $row['kyc_status'] == "review" )


{
   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="nk-block">
                        <div class="nk-block-head">
                            <div class="nk-block-head-content">
                                <h5 class="nk-block-title">Security Settings</h5>
                                <div class="nk-block-des">
                                    <p>These settings are helps you keep your  <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>  account secure.</p>
                                </div>
                            </div>
                        </div><!-- .nk-block-head -->
                        <div class="card card-bordered">
                            <div class="card-inner-group">
                                <div class="card-inner">
                                    <div class="between-center flex-wrap flex-md-nowrap g-3">
                                        <div class="nk-block-text">
                                            <h6>Save my Activity Logs</h6>
                                            <p>You can save all activity logs including unusual activity detected.</p>
                                        </div>
                                        <div class="nk-block-actions">
                                            <ul class="align-center gx-3">
                                                <li class="order-md-last d-inline-flex">
                                                    <div class="custom-control custom-switch mr-n2">
                                                        <input type="checkbox" class="custom-control-input"
                                                            id="activity-log">
                                                        <label class="custom-control-label" for="activity-log"></label>
                                                    </div>
                                                </li>
                                                <li>
                                                    <a href="activity-logs" class="link link-sm link-primary">See Recent
                                                        Activity</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div><!-- .card-inner -->
                                <div class="card-inner">
                                    <div class="between-center flex-wrap flex-md-nowrap g-3">
                                        <div class="nk-block-text">
                                            <h6>Security Pin Code</h6>
                                            <p>You can set your pin code, we will ask you this code during login
                                                attempts and transactions.</p>
                                        </div>
                                        <div class="nk-block-actions">
                                            <div class="custom-control custom-switch mr-n2">
                                                <input type="checkbox" checked="" class="custom-control-input"
                                                    id="security-pin">
                                                <label class="custom-control-label" for="security-pin"></label>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- .card-inner -->
                                <div class="card-inner">

                                </div><!-- .card-inner -->
                                <div class="card-inner">
                                    <div class="between-center flex-wrap flex-md-nowrap g-3">
                                        <div class="nk-block-text">
                                            <h6>2FA Authentication <span class="badge badge-success">Enabled</span></h6>
                                            <p>Secure your account with 2FA security. When it is activated you will need
                                                to enter not only your password, but also a special code using app. You
                                                can receive this code by in mobile app. </p>
                                        </div>

                                    </div>
                                </div><!-- .card-inner -->
                            </div><!-- .card-inner-group -->
                        </div><!-- .card -->
                        <div class="nk-block-head nk-block-head-sm">
                            <div class="nk-block-head-content">
                                <div class="nk-block-title-group">
                                    <h6 class="nk-block-title title">Recent Activity</h6>
                                    <a href="activity-logs" class="link">See full log</a>
                                </div>
                                <div class="nk-block-des">
                                    <p>This information about recent login activity on your account.</p>
                                </div>
                            </div>
                        </div><!-- .nk-block-head -->
                        <?php

$sql = "SELECT * FROM user_logs WHERE user = '" . mysqli_real_escape_string($mysqli, $chap) . "' ORDER BY log_time DESC";
$result = mysqli_query($mysqli, $sql);
?>

<div class="card card-bordered" style="overflow-x:auto;">
    <table class="table table-ulogs" style="width:100%;min-width:400px;">
        <thead class="thead-light">
            <tr>
                <th class="tb-col-os"><span class="overline-title">Browser</span></th>
                <th class="tb-col-time"><span class="overline-title">Time</span></th>
            </tr>
        </thead>
        <tbody>
            <?php while($log = mysqli_fetch_assoc($result)) { ?>
            <tr>
                <td class="tb-col-os"><?php echo $log['browser']; ?></td>
                <td class="tb-col-time"><span class="sub-text"><?php echo date('d M y, h:i a', strtotime($log['log_time'])); ?></span></td>
            </tr>
            <?php } ?>
        </tbody>
    </table>
</div><!-- .card --><!-- .card -->
                    </div><!-- .nk-block -->
                </div>
            </div>
        </div>
    </div>
    <?php include 'includes/footer.php'; ?>

</html>