<?php
session_start();
include '../backend/db/db.php';


if(isset($_SESSION['normal_user_bb'])) {
	$uid = htmlspecialchars(strip_tags(trim($_SESSION['normal_user_bb'])), ENT_QUOTES, 'UTF-8');	

} else {
	$uid = '';
}

if(empty($uid)) {
	$redirectUrl = "../sign-in";
	echo "<script type=\"text/javascript\">";
	echo "window.location.href = '$redirectUrl'";
	echo "</script>";

} else {
	$sqlu = "SELECT * FROM customer_reg WHERE cusID=$uid and val='1'";
	$resultu = mysqli_query($conn, $sqlu);
	$countu = mysqli_num_rows($resultu);
	
	if($countu == 1) {
		$row = mysqli_fetch_array($resultu);
		$name = $row['f_name'];

	} else {
		$redirectUrl = "../sign-out";
		echo "<script type=\"text/javascript\">";
		echo "window.location.href = '$redirectUrl'";
		echo "</script>";
	}
}

if(isset($_GET['pg'])) {
	$pg = htmlspecialchars(strip_tags(trim($_GET['pg'])), ENT_QUOTES, 'UTF-8');

} else {
	$pg = '';
}
?>

<div class="navbar navbar-fixed-top scroll-hide">
	<div class="container-fluid top-bar">
	  <div class=pull-right>
		<ul class="nav navbar-nav pull-right">
		  <li class="dropdown user"><a data-toggle=dropdown class=dropdown-toggle href="#" style="text-transform:capitalize;"> <img width=34 height=34 src="images/user.png"/><?php echo $name ?><b class=caret></b></a>
			<ul class=dropdown-menu>
			  <li><a href="../"> <i class="fa fa-globe"></i> Back to Website</a> </li>
			  <li><a href="../bookstore-sudila-printers-sri-lanka"> <i class="fa fa-book"></i> Book Store</a> </li>
			  <li><a href="../my-cart"> <i class="fa fa-shopping-cart"></i> My Cart</a> </li>
			  <li><a href="../sign-out"> <i class="fa fa-sign-out"></i> Logout</a> </li>
			</ul>
		  </li>
		</ul>
	  </div>
	  <button class=navbar-toggle><span class=icon-bar></span><span class=icon-bar></span><span class=icon-bar></span></button>
	  <a class="logo" href="../">Buddhist Books - Kurunegala Sri Lanka</a> </div>
	<div class="container-fluid main-nav clearfix">
	  <div class=nav-collapse>
		<ul class=nav>
		  <li><a class="<?php if($pg == '') { echo 'current'; } ?>" href="index"><i class="fa fa-home"></i>Dashboard</a></li>
		  <li><a href="wish-list"><i class="fa fa-heart"></i>Wish List</a></li>
		  <li><a class="<?php if($pg == 1) { echo 'current'; } ?>" href="online-orders?pg=1"><i class="fa fa-clipboard"></i>Pending Orders</a></li>
		  <li><a class="<?php if($pg == 2) { echo 'current'; } ?>" href="online-orders?pg=2"><i class="fa fa-check-square-o"></i>Accepted Orders</a></li>
		  <li><a class="<?php if($pg == 3) { echo 'current'; } ?>" href="online-orders?pg=3"><i class="fa fa-th-list"></i>Order History</a></li>
		  <li><a href="../bookstore-sudila-printers-sri-lanka"> <i class="fa fa-book"></i>Book Store</a></li>
		  <li><a href="../my-cart"> <i class="fa fa-shopping-cart"></i>My Cart</a></li>
		  <li><a href="user-account"> <i class="fa fa-user"></i>Edit Account</a></li>          
		</ul>
	  </div>
	</div>
</div>