<?php
ob_start();
session_start();
require_once($_SERVER['DOCUMENT_ROOT'] . "/include/Function.php");

// $user_id = userDetails('id');
if (isset($_SESSION["name"])) {
    if ((time() - $_SESSION['last_login_timestamp']) > 60) // 900 = 15 * 60  
    {
        header("location:logout");
    } else {
        $_SESSION['last_login_timestamp'] = time();
        echo "<h1 align='center'>" . $_SESSION["name"] . "</h1>";
        echo '<h1 align="center">' . $_SESSION['last_login_timestamp'] . '</h1>';
        echo "<p align='center'><a href='logout.php'>Logout</a></p>";
    }
}


if (!$_SESSION['acct_email']) {
    header("location:../login.php");
    exit;
}

// // audit_logs
$sql = "SELECT * FROM audit_logs ORDER BY datenow DESC";
$stmt = $conn->prepare($sql);
$stmt->execute();

$logs = $stmt->fetch(PDO::FETCH_ASSOC);



$acct_balance = $row['acct_balance'];


?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><?= $pageName?> - <?= $page['url_name'] ?></title>
    <meta name="referrer" content="no-referrer-when-downgrade">
    <!-- <link rel="stylesheet" href="/static/assets/flaticon/css/uicons-regular-rounded.css"> -->
    <link rel="stylesheet" href="<?= $web_url ?>/static/vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?= $web_url ?>/static/docs/css/light.css">
    <link rel="stylesheet" href="<?= $web_url ?>/static/docs/css/major.css">
    <link rel="stylesheet" href="<?= $web_url ?>/static/docs/css/animate.css">
    <link rel="shortcut icon" type="image/jpg" href="<?= $web_url ?>/static/assets/images/bsc.png" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu|Noto Sans|Source Sans Pro|Roboto|Merriweather Sans">
    <link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Anuphan:wght@500&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Anuphan:wght@400&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Anuphan:wght@600&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="<?= $web_url ?>/static/assets/plugin/jquery/jquery-ui.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css">
    <link rel="stylesheet" href="<?= $web_url ?>/static/assets/css/fontawesome.css">

    <script src="<?= $web_url ?>/static/vendor/jquery/jquery.js"></script>
    <style>
        input[type=file] {
            display: none;
        }

        ::-webkit-file-upload-button {
            background: none;
            border: 1px solid #74d6d8;
            color: #74d6d8;
            padding: 8px;
            border-radius: 8px;
        }
    </style>
</head>

<body class="white-bg">
    <!-- Page Preloader -->
    <div class="page-preloader">
        <div class="page-preloader-wrapper">
            <div class="loader justify-content-center m-0" style="height: 10px;">
                <span class="bar" style="border-radius: 0px;"></span>
                <span class="bar" style="border-radius: 0px;"></span>
                <span class="bar" style="border-radius: 0px;"></span>
                <span class="bar" style="border-radius: 0px;"></span>
            </div>
        </div>
    </div>
    <!-- End Page Preloader -->

    <!-- Activity Loader -->
    <div class="dialog activityLoader" style="background: rgba(0, 0, 0, 0.8); display: none;">
        <div class="dialogContent text-center" style="background: none; box-shadow: none;">
            <div class="lds-dual-ring"></div>
        </div>
    </div>
    <!-- Activity Loader -->

    <!-- messages -->

    <!-- end messages -->

    <div class="site-container">
        <!-- mobile nav bar -->
        <div class="d-block d-sm-none">
            <div class="container-fluid anuphan" style="z-index: 4;">
                <div class="row py-3">
                    <div class="col-5">
                        <a href="/">
                            <img src="<?= $web_url ?>/static/assets/images/logo.png" alt="bscotc" style="height: 25px; width: 120px;">
                        </a>
                    </div>
                    <div class="col-7">
                        <div class="d-flex justify-content-end">
                            <a href="./withdraw.php">
                                <button class="anuphan-2 py-1 xsmall fit-content px-3">
                                    <i class="bi bi-download"></i>
                                    Withdraw
                                </button>
                            </a>
                            <img src="<?= $web_url ?>/static/assets/images/avatar-5.png" alt="profile" style="width: 25px; height: 25px;" class="top-2 ml-3" onclick="accountMangt(this)">
                            <i class="material-icons ml-2 top-1" style="font-size: 30px;" onclick="openSideBarSm()">menu</i>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- account control panel -->
        <div class="account-control-panel-overlay" style="display: none; background: rgba(0, 0, 0, 0.2) !important;" onclick="closeAccountMangt()"></div>
        <div class="account-control-panel dark-bg3 shadow-sm p-0" style="padding: 0px; display: none; box-shadow: none; border-radius: 0;">
            <div>
                <div class="border-bottom mb-1">
                    <p class="m-0 mt-2 p-3">
                        <b><?= $row['acct_email'] ?></b>
                    </p>

                </div>

                <a href="./dashboard.php" class="mainWhite">
                    <div class="a-p-inner px-3 py-2 pb-3">
                        <i class="material-icons top-3 grey-color-3" style="font-size: 18px">person</i> &nbsp;
                        <span>Dashboard</span>
                    </div>
                </a>
                <a class="mainWhite pointer" href="./profile.php">
                    <div class="a-p-inner px-3 py-2 pb-3">
                        <i class="material-icons top-3 grey-color-3" style="font-size: 18px">fact_check</i> &nbsp;
                        <span>My Profile</span>
                    </div>
                </a>
                
                <a class="mainWhite pointer" href="./ticket.php">
                    <div class="a-p-inner px-3 py-2 pb-3">
                        <i class="material-icons top-3 grey-color-3" style="font-size: 18px">fact_check</i> &nbsp;
                        <span>Ticket</span>
                    </div>
                </a>
                <a class="mainWhite pointer" href="./security.php">
                    <div class="a-p-inner px-3 py-2 pb-3">
                        <i class="material-icons top-3 grey-color-3" style="font-size: 18px">lock</i> &nbsp;
                        <span>Security</span>
                    </div>
                </a>
                <a class="mainWhite pointer" href="./settings.php">
                    <div class="a-p-inner px-3 py-2 pb-3">
                        <i class="material-icons top-4 grey-color-3" style="font-size: 18px">tune</i> &nbsp;
                        <span>Settings</span>
                    </div>
                </a>
                
                <a class="mainWhite pointer" href="./wallet.php">
                    <div class="a-p-inner px-3 py-2 pb-3">
                        <i class="material-icons top-3 grey-color-3" style="font-size: 18px">account_balance_wallet</i> &nbsp;
                        <span>Wallet</span>
                    </div>
                </a>
                
                
                
               
            </div>
        </div>


        <script>
            // account management modal
            const accountMangt = (e) => {
                $('.account-control-panel-overlay').fadeIn(150)
                $('.account-control-panel').show('drop', {
                    direction: 'up'
                }, 200)
            }
            const closeAccountMangt = (e) => {
                $('.account-control-panel-overlay').fadeOut(150)
                $('.account-control-panel').hide('drop', {
                    direction: 'up'
                }, 200)
                $(e).attr('onclick', 'accountMangt(this)')
                $('.accountMangtBtn').each(function() {
                    $(this).attr('onclick', 'accountMangt(this)')
                })
            }
        </script>
        <!-- mobile nav bar -->
        <div class="d-block d-sm-none">
            <div class="position-relative" style="min-height: 54px;">
                <div class="scrollmenu nav-header-sm-db" style="white-space: nowrap;">
                    <a href="./dashboard.php" class="s-m-item nav-header-sm-item ">Dashboard</a>
                    <a href="./security.php" class="s-m-item ml-3 nav-header-sm-item ">Security</a>
                    <a href="./wallet.php" class="s-m-item ml-3 nav-header-sm-item ">Wallet</a>
                    <a href="./profile.php" class="s-m-item ml-3 nav-header-sm-item ">Identification</a>
                     <a href="./ticket.php" class="s-m-item ml-3 nav-header-sm-item ">Ticket</a>
                   
                    <a href="./transactions.php" class="s-m-item ml-3 nav-header-sm-item ">Operations</a>
                    <a href="./settings.php" class="s-m-item mx-3 nav-header-sm-item ">Settings</a>
                </div>
            </div>
        </div>

        <!-- Side bar mobile -->
        

        <!-- Header desktop -->
        <!-- ## -->
        <div class="d-none d-md-block row border-bottom">
            <div class="col-12">
                <nav class="navbar navbar-expand-lg px-4 sticky-top  dark-bg shadow-none" style="z-index:999 !important;">
                    <a class="navbar-brand" href="/binance-otc">
                        <p class="m-0 name-brand bold-text">
                            <img src="<?= $web_url ?>/static/assets/images/logo.png" alt="bscotc" style="height: 25px; width: 130px;">
                        </p>
                    </a>
                    
                    <div class="collapse navbar-collapse" id="navbarNav" style="font-family: 'anuphan';">
                        <ul class="navbar-nav" style="font-size: 14px;">
                            <li class="nav-item mt-2">
                                <i class="bi bi-grid-3x3-gap-fill" style="font-size: 20px;"></i>
                                <i class="bi bi-caret-down-fill grey-color ml-1 n-top-2" style="font-size: 12px;"></i>
                            </li>
                            <li class="nav-item ml-4">
                                <a href="#" class="nav-link xsmall  mt-2">
                                    Buy Crypto
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    Markets
                                    <i class="fa fa-caret-down grey-color-3"></i>
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    Trade
                                    <i class="fa fa-caret-down grey-color-3"></i>
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    Derivatives
                                    <i class="fa fa-caret-down grey-color-3"></i>
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    Earn
                                    <i class="fa fa-caret-down grey-color-3"></i>
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    Payment
                                    <i class="fa fa-caret-down grey-color-3"></i>
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    NFT
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="#" class="nav-link xsmall mt-2">
                                    Institutional
                                    <i class="fa fa-caret-down grey-color-3"></i>
                                </a>
                            </li>
                        </ul>

                        <ul class="navbar-nav ml-auto" style="font-size: 14px;">
                            <li class="nav-item mr-2 ml-4 mt-1">
                                <a href="./withdraw.php" class="nav-link">
                                    <button class="px-4 py-1 xsmall anuphan reg-btn add-radius-sm">
                                        <i class="bi bi-download"></i>
                                        Withdraw
                                    </button>
                                </a>
                            </li>
                            <li class="nav-item mt-3">
                                <img src="<?= $web_url ?>/static/assets/images/avatar-5.png" alt="profile" style="width: 25px; height: 25px;" class="n-top-2 pointer" onclick="accountMangt(this)">
                            </li>
                            <li class="nav-item mt-3">
                                <i class="bi bi-globe ml-3 n-top-3" style="font-size: 18px;"></i>
                            </li>
                            <li class="nav-item mt-3">
                                <i class="bi bi-moon-fill ml-3 n-top-1" style="font-size: 12px;"></i>
                            </li>
                        </ul>
                    </div>
                </nav>
            </div>
        </div>

        <!-- -------------- -->
        <div class="container-fluid">
            <div class="row" style="height:100%;">
                <!-- Side bar desktop -->
                <div class="col-md-3 sideBar d-none d-sm-block shadow-none" style="padding:0px;">
                    <div class="anuphan">
                        <a href="./dashboard.php">
                            <div class="side-link side-link-active">
                                <i class="material-icons">person</i> &nbsp;
                                <span>Dashboard</span>
                            </div>
                        </a>
                        <a href="./security.php" class="moreWhite blue-bg">
                            <div class="side-link  ">
                                <i class="material-icons">lock</i> &nbsp;
                                <span>Security</span>
                            </div>
                        </a>
                        <a href="./wallet.php" class="moreWhite blue-bg">
                            <div class="side-link">
                                <i class="material-icons">account_balance_wallet</i> &nbsp;
                                <span>Wallet</span>
                            </div>
                        </a>
                        <a href="./profile.php" class="moreWhite blue-bg">
                            <div class="side-link">
                                <i class="material-icons">fact_check</i> &nbsp;
                                <span>Identification</span>
                            </div>
                        </a>
                         <a href="./ticket.php" class="moreWhite blue-bg">
                            <div class="side-link">
                                <i class="material-icons">fact_check</i> &nbsp;
                                <span>Ticket</span>
                            </div>
                        </a>
                        
                        <a href="./transactions.php" class="moreWhite blue-bg">
                            <div class="side-link">
                                <i class="material-icons">receipt_long</i> &nbsp;
                                <span>Orders</span>
                            </div>
                        </a>
                        <a href="./settings.php" class="moreWhite blue-bg">
                            <div class="side-link">
                                <i class="material-icons">tune</i> &nbsp;
                                <span>Settings</span>
                            </div>
                        </a>
                    </div>
                </div>

                <!-- --------------- -->