<?php
/**
* dashboard.php -- Dashboard
*/

include '../inc/config.inc.php'; // Configuration

ob_start();
session_start();

//date_default_timezone_set('Africa/Lagos');

error_reporting(E_ALL);
ini_set('display_errors', 1);

if ( !isset($_SESSION['user']) || $_SESSION["loggedin"] !== true || trim($_SESSION['user']) == '' ){
header('Location: ' . $BASE_URL . 'signin');
exit;
}

// User Details
$stmt = $db_con->prepare("SELECT * FROM users WHERE id=:user_id");
$stmt->execute(array(":user_id"=>$_SESSION['user']));
$userRow = $stmt->fetch(PDO::FETCH_ASSOC);

// Get Total Balance
$userTB = $db_con->prepare("SELECT current_balance FROM user_total_balance WHERE user_id='".$userRow['id']."'");
$userTB->execute(); $tb = $userTB->fetch(PDO::FETCH_ASSOC);

// Get Total Earning
$userTE = $db_con->prepare("SELECT current_balance FROM user_total_earning WHERE user_id='".$userRow['id']."'");
$userTE->execute(); $te = $userTE->fetch(PDO::FETCH_ASSOC);

// Get Active Deposit
$userAD = $db_con->prepare("SELECT current_balance FROM user_active_deposit WHERE user_id='".$userRow['id']."'");
$userAD->execute(); $ad = $userAD->fetch(PDO::FETCH_ASSOC);

// Get Total Deposit
$userTD = $db_con->prepare("SELECT current_balance FROM user_total_deposit WHERE user_id='".$userRow['id']."'");
$userTD->execute(); $td = $userTD->fetch(PDO::FETCH_ASSOC);

// Get Total Withdrawal
$userTW = $db_con->prepare("SELECT current_balance FROM user_total_withdrawal WHERE user_id='".$userRow['id']."'");
$userTW->execute(); $tw = $userTW->fetch(PDO::FETCH_ASSOC);

// Get Last Deposit
$userLD = $db_con->prepare("SELECT current_balance FROM user_last_deposit WHERE user_id='".$userRow['id']."'");
$userLD->execute(); $ld = $userLD->fetch(PDO::FETCH_ASSOC);

// Get Last Withdrawal
$userLW = $db_con->prepare("SELECT current_balance FROM user_last_withdrawal WHERE user_id='".$userRow['id']."'");
$userLW->execute(); $lw = $userLW->fetch(PDO::FETCH_ASSOC);

// Get Pending Withdraw
$userPW = $db_con->prepare("SELECT current_balance FROM user_pending_withdraw WHERE user_id='".$userRow['id']."'");
$userPW->execute(); $pw = $userPW->fetch(PDO::FETCH_ASSOC);

// Get Trade Session
$userTS = $db_con->prepare("SELECT * FROM user_trade_session WHERE user_id='".$userRow['id']."'");
$userTS->execute(); $trade = $userTS->fetch(PDO::FETCH_ASSOC);

// Get Profit Lost
$userPL = $db_con->prepare("SELECT * FROM user_profit_lost WHERE user_id='".$userRow['id']."'");
$userPL->execute(); $pl = $userPL->fetch(PDO::FETCH_ASSOC);

?>

<!doctype html>
<html lang="en-uk">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="investment, Forex, Trading, Bitcoin, Cryptocurrency, Global investment, Live Trade, Trading class, indics">
<meta name="author" content="Paul HubWeb & Tech">
<meta name="theme-color" content="#808080" />
<!-- Site Properties -->
<title>Dashboard </title>
<link rel="shortcut icon" href="../img/Signals-Alert-3.png" type="image/x-icon" />
<link rel="apple-touch-icon-precomposed" href="../img/Signals-Alert-3.png" />
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Typography CSS -->
<link rel="stylesheet" href="css/typography.css">
<!-- Style CSS -->
<link rel="stylesheet" href="css/style.css">
<!-- Responsive CSS -->
<link rel="stylesheet" href="css/responsive.css">
<style>
* {
box-sizing: border-box;
}

body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}

.header {
overflow: none;
background-color: none;
padding: 20px 10px;
padding-left: 5px;
position: fixed;
}

/*.header a {
float: center;
width:30px;
color: #fff;
text-align: center;
padding: 12px;
text-decoration: none;
font-size: 18px; 
line-height: 25px;
border-radius: 4px;
background-color:rgb(196, 0, 0);
border-color: rgb(196, 0, 0);
}*/

.header a.logo {
font-size: 25px;
font-weight: bold;
}

/*.header a:hover {
background-color:  #010847;
color: #fff;
}*/

/*.header a.active {
background-color: dodgerblue;
color: white;
}*/

.header-center {
float: left;
}

@media screen and (max-width: 500px) {
.header a {
float: none;
display: block;
text-align: left;
}

.header-right {
float: none;
}
}
</style>

<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700" rel="stylesheet" />
<style>
/*------ Google Font Style ------ */
body {font-family:'Roboto'!important;}
</style>

</head>
<body>
<!-- loader Start -->
<!-- loader END -->
<!-- Wrapper Start -->
<div class="wrapper">
<div id="content-page" class="content-page">
<?php include 'navbar.php' ?>
<div class="container-fluid">
<div class="row content-body">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height" style="height:400px; margin-top:60px;">
<div class="iq-card-body">
<div class="row">
<div class="column" style="background-color:none; border-bottom: Solid red; border-top:Solid blue; border-left:Solid blue; border-right:Solid blue
; border-radius:20px;">
<div class="iq-waves-effect d-flex">
<a href="profile.php">
<?php
if ( empty($userRow['picture']) ){
echo '<img class="profile-pic" src="images/user/11.png" alt="profile-pic" style="width:120px; height:180px; padding-bottom:50px">';
} else {
echo '<img class="profile-pic" src="uploads/'.$userRow['picture'].'" alt="profile-pic" style="width:120px; height:180px; padding-bottom:50px">';
}
?>
</a>
<table>
<thead>
<tr>
<th scope="col" style="padding-left:40px; padding-bottom:250px;">
<b style="color:black; padding-bottom:250px;">
Username:<br>
Registration Date:<br>
Last Access:<br>
Verification Status:<br>
Account Status:
</b>
</th>
<th scope="col" style="padding-left:40px; padding-bottom:250px;">
<b style="color:black;padding-bottom:250px;">
<?= $userRow['username']; ?><br>
<?= date('M-d-Y', strtotime($userRow['created'])); ?><br>
 <?= date('M-d-Y h:i:s', strtotime($userRow['last_login'])); ?><br>
<?php
if ($userRow['status'] == 'Pending Verification'){ 
$sall = '#ffa500';
}else{
if ($userRow['status'] == 'Not Verified'){ 
$sall = 'red';
}else{
if ($userRow['status'] == 'Verified'){ 
$sall = 'green';
}else{
    
}   
} 
}
?>
<span style="color:<?php echo $sall; ?>;"><?= $userRow['status']; ?><i class="las la-check-circle" style="color:<?php echo $sall; ?>;"></i></span><br>
<?= $userRow['current_plan']; ?>
<br>
</b>
</th>
</tr>
</thead>
</table>

</div>
</div>
</div>
<style>
* {
box-sizing: border-box;
}

/* Create two equal columns that floats next to each other */
.column {
float: left;
width: 100%;
padding: 10px;
height: 150px;
/* Should be removed. Only for demonstration */
}

/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}

/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.column {
width: 100%;
}
}
</style>
<div class="mt-4" style="padding-top:50px">
<img src="images/pound-symbol (3).svg" width="60px">
<h2 style="font-size:30px; font-family: 'Roboto'!important;">Total Balance: <span style="font-size:30px; float:right; color:rgb(196, 0, 0);"><?= $userRow['currency'] . number_format($tb['current_balance'], 2); ?></span></h2>
<?php
if ($userRow['allow_withdraw'] == 'No'){ ?>
<p style="color: rgb(196, 0, 0); float:right;"> non-spendable</p>
<?php
}
/*if ($userRow['status'] == 'Active'){ ?>
<p style="color: rgb(196, 0, 0); float:right;">Profit Lost: <?= number_format($pl['current_balance'], 2); ?></p>
<?php }*/ ?>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div class="mt-4">
<img src="images/investment-insurance (2).svg" width="80px">
<h2 style="font-size:30px; font-family:'Roboto'!important;">Active Deposit:<br> <span style="font-size:20px; float:left; color:rgb(196, 0, 0);"><?= $userRow['currency'] . number_format($ad['current_balance'], 2); ?></span></h2>
<!--<p>Frontend time</p>-->
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div class="mt-4">
<img src="images/earnings (1).svg" width="80px">
<h2 style="font-size:30px; font-family:'Roboto'!important;">Total Earning:<br> <span style="font-size:20px; color:rgb(196, 0, 0); float:left;"><?= $userRow['currency'] . number_format($te['current_balance'], 2); ?></span></h2>
<!--<p>Frontend time</p>-->
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div class="mt-4">
<img src="images/withdraw.svg" width="80px">
<h2 style="font-size:30px; font-family:'Roboto'!important;">Total Deposit:<br> <span style="font-size:20px; color:rgb(196, 0, 0); float:left;"><?= $userRow['currency'] . number_format($td['current_balance'], 2); ?></span></h2>
<!--<p>Frontend time</p>-->
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div class="mt-4">
<img src="images/security-box.svg" width="80px">
<h2 style="font-size:30px; font-family:'Roboto'!important;">Total Withdrawal:<br> <span style="font-size:20px; float:left; color:rgb(196, 0, 0);"><?= $userRow['currency'] . number_format($tw['current_balance'], 2); ?></span></h2>
<!--<p>Frontend time</p>-->
</div>
</div>
</div>
</div>
<div class="col-lg-12 row m-0 p-0 iq-duration-block">
<div class="col-sm-6 col-md-2 col-lg-2">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div>
<img src="images/withdraw (2).svg" width="80px">
</div>
<div class="mt-4">
<h2 style="font-size:15px; font-family:'Roboto'!important;">Last Deposit:</h2>
<p><span style="color:rgb(196, 0, 0);"><?= $userRow['currency'] . number_format($ld['current_balance'], 2); ?></span></p>
</div>
<div id="ethernet-chart-01"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-2 col-lg-2">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div>
<img src="images/withdraw (1).svg" width="80px">
</div>
<div class="mt-4">
<h2 style="font-size:15px; font-family:'Roboto'!important;">Last Withdrawal:</h2>
<p><span style="color:rgb(196, 0, 0);"><?= $userRow['currency'] . number_format($lw['current_balance'], 2); ?></span></p>
</div>
<div id="ethernet-chart-02"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-2 col-lg-2">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<div>
<img src="images/donation.svg" width="80px">
</div>
<div class="mt-4">
<h2 style="font-size:15px; font-family:'Roboto'!important;">Pending Withdraw:</h2>
<p><span style="color:rgb(196, 0, 0);"><?= $userRow['currency'] . number_format($pw['current_balance'], 2); ?></span></p>
</div>
<div id="ethernet-chart-03"></div>
</div>
</div>
</div>
<div class="col-md-6 col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-body">
<h4 class="text-uppercase text-black mb-0" style="font-family:'Roboto'!important;">Trading Session(Now Active)</h4>
<div class="d-flex justify-content-between align-items-center">
<div class="font-size-80 text-black"><?= $trade['completion']; ?>/<small><?= $trade['number']; ?></small></div>
<div class="text-left">
<p class="m-0 text-uppercase font-size-12">1 Hours Ago</p>
<div class="mb-1 text-black">1500<span class="text-danger"><i class="ri-arrow-down-s-fill"></i>3.25%</span></div>
<p class="m-0 text-uppercase font-size-12">1 Day Ago</p>
<div class="mb-1 text-black">1890<span class="text-success"><i class="ri-arrow-down-s-fill"></i>1.00%</span></div>
<p class="m-0 text-uppercase font-size-12">1 Week Ago</p>
<div class="text-black">1260<span class="text-danger"><i class="ri-arrow-down-s-fill"></i>9.87%</span></div>
</div>
</div>
<div id="wave-chart-7"></div>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-header d-flex justify-content-between">
<div class="iq-header-title">
<h4 class="card-title" style="font-family:'Roboto'!important;">Load Time - Last 24 hours</h4>
</div>
</div>
<div class="iq-card-body">
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<div id="analytics-platform"></div>
<div class="tradingview-widget-copyright"></div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"container_id": "analytics-platform",
"width": 920,
"height": 610,
"symbol": "NASDAQ:AAPL",
"interval": "D",
"timezone": "exchange",
"theme": "dark",
"style": "0",
"toolbar_bg": "#808080",
"withdateranges": true,
"allow_symbol_change": true,
"save_image": false,
"details": true,
"hotlist": true,
"calendar": true,
"locale": "en"
});
</script>
</div>
<!-- TradingView Widget END -->
</div>
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-header d-flex justify-content-between">
<div class="iq-header-title">
<h4 class="card-title" style="font-family:'Roboto'!important;">Active Instances</h4>
</div>
</div>
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<div class="tradingview-widget-container__widget"></div>
<div class="tradingview-widget-copyright"></div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-forex-cross-rates.js" async>
{
"width": 910,
"height": 610,
"currencies": [
"EUR",
"USD",
"JPY",
"GBP",
"CHF",
"AUD",
"CAD",
"NZD",
"CNY"
],
"isTransparent": false,
"colorTheme": "dark",
"locale": "en"
}
</script>
</div>
<!-- TradingView Widget END -->
</div>
</div>
<div class="col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-header d-flex justify-content-between">
<div class="iq-header-title">
<h4 class="card-title" style="font-family:'Roboto'!important;">Daily Crypto Prices</h4>
</div>
</div>
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container bodyi">
<div class="tradingview-widget-container__widget"></div>
<div class="tradingview-widget-copyright"></div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-screener.js" async>
{
"width": 900,
"height": 490,
"defaultColumn": "overview",
"screener_type": "crypto_mkt",
"displayCurrency": "USD",
"colorTheme": "dark",
"locale": "en"
}
</script>
</div>
<!-- TradingView Widget END -->
</div>
</div>
<div class="col-lg-6">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-header d-flex justify-content-between border-none">
<div class="iq-header-title">
<h5 class="card-title" style="font-family:'Roboto'!important;">Ongoing Active Investment Worldwide</h5>
</div>
</div>
<div class="iq-card-body">
<div id="world-map" style="height: 250px;"></div>
</div>
</div>
</div>
<!--<div class="col-lg-4">
<div class="iq-card iq-card-block iq-card-stretch iq-card-height">
<div class="iq-card-header d-flex justify-content-between">
<div class="iq-header-title">
<h4 class="card-title">Latest Browser Check</h4>
</div>
</div>

</div>
</div>-->
</div>
</div>
</div>
</div>
<!-- Wrapper END -->
<!-- Footer -->
<?php include 'footer.php' ?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="js/jquery.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- Appear JavaScript -->
<script src="js/jquery.appear.js"></script>
<!-- Countdown JavaScript -->
<script src="js/countdown.min.js"></script>
<!-- Counterup JavaScript -->
<script src="js/waypoints.min.js"></script>
<script src="js/jquery.counterup.min.js"></script>
<!-- Wow JavaScript -->
<script src="js/wow.min.js"></script>
<!-- Apexcharts JavaScript -->
<script src="js/apexcharts.js"></script>
<!-- Slick JavaScript -->
<script src="js/slick.min.js"></script>
<!-- Select2 JavaScript -->
<script src="js/select2.min.js"></script>
<!-- Owl Carousel JavaScript -->
<script src="js/owl.carousel.min.js"></script>
<!-- Magnific Popup JavaScript -->
<script src="js/jquery.magnific-popup.min.js"></script>
<!-- Smooth Scrollbar JavaScript -->
<script src="js/smooth-scrollbar.js"></script>
<!-- lottie JavaScript -->
<script src="js/lottie.js"></script>
<!-- am core JavaScript -->
<script src="js/core.js"></script>
<!-- am charts JavaScript -->
<script src="js/charts.js"></script>
<!-- am animated JavaScript -->
<script src="js/animated.js"></script>
<!-- am kelly JavaScript -->
<script src="js/kelly.js"></script>
<!-- am maps JavaScript -->
<script src="js/maps.js"></script>
<!-- am worldLow JavaScript -->
<script src="js/worldLow.js"></script>
<!-- Raphael-min JavaScript -->
<script src="js/raphael-min.js"></script>
<!-- Morris JavaScript -->
<script src="js/morris.js"></script>
<!-- Morris min JavaScript -->
<script src="js/morris.min.js"></script>
<!-- Flatpicker Js -->
<script src="js/flatpickr.js"></script>
<!-- Style Customizer -->
<script src="js/style-customizer.js"></script>
<!-- Chart Custom JavaScript -->
<script src="js/chart-custom.js"></script>
<!-- Custom JavaScript -->
<script src="js/custom.js"></script>
</body>
</html>