<?php
include "backend/db/db.php";
session_start();
?>
<!-- Header -->
<div id="preloader"></div>

<header id="wn__header" class="header__area header__absolute sticky__header">
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-8 col-sm-8 col-6 col-lg-3">
        <div class="logo"> <a href="index.php"> <img src="images/logo/logo.png" alt="Buddhist Books"> </a> </div>
      </div>
      <div class="col-lg-7 d-none d-lg-block">
        <nav class="mainmenu__nav">
          <ul class="meninmenu d-flex justify-content-start">
            <li><a href="index.php">Home</a></li>
            <li class="drop"><a href="bookstore-sudila-printers-sri-lanka">Book Store</a>
              <div class="megamenu mega02">
                <?php
				$sql_cat = mysqli_query($conn, "SELECT * FROM category");
                $tot_cat = mysqli_num_rows($sql_cat)/2; 
                $n = ceil($tot_cat);
                $start = 0;
				$x = 2;
				while($x > 0) { ?>
                <ul class="item item02">
                  <?php
				$sql_c = mysqli_query($conn, "SELECT * FROM category ORDER BY category ASC LIMIT $start, $n");
				while($row_c = mysqli_fetch_array($sql_c)) { ?>
                  <li><a href="bookstore-sudila-printers-sri-lanka?c=<?php echo $row_c['search_id']; ?>"><?php echo $row_c['category']; ?> </a></li>
                  <?php } ?>
                </ul>
                <?php  $start+=$n;  $x--; } ?>
              </div>
            </li>
            <li><a href="authors-sudila-printers-sri-lanka">Authors</a></li>
            <li><a href="publishers-sudila-printers-sri-lanka">Publishers</a></li>
            <li><a href="contact-sudila-printers-sri-lanka">Contact</a></li>
          </ul>
        </nav>
      </div>
      <div class="col-md-4 col-sm-4 col-6 col-lg-2">
        <ul class="header__sidebar__right d-flex justify-content-end align-items-center">
          <li class="shop_search"><a class="search__active" href="#"></a></li>
          <li class="wishlist" title="My Wishlist"><a href="user_acc/wish-list"><span class="tot_wish"></span></a></li>
          <li class="shopcart"><a class="cartbox_active" href="#" title="My Cart"><span class="product_qun"></span></a> 
            <!-- Start Shopping Cart -->
            <div class="block-minicart minicart__active">
            </div>
            <!-- End Shopping Cart --> 
          </li>
          <li class="setting__bar__icon"><a class="setting__active" href="#"></a>
            <div class="searchbar__content setting__block">
              <div class="content-inner">
                <div class="switcher-currency"> <strong class="label switcher-label"> <span>My Account</span> </strong>
                  <div class="switcher-options">
                    <div class="switcher-currency-trigger">
                      <div class="setting__menu">
					  <?php if(isset($_SESSION['normal_user_bb'])) { ?>
					  <span><a href="user_acc/">Dashboard</a></span>
					  <span><a href="user_acc/wish-list">My Wishlist</a></span>
					  <span><a href="user_acc/">Search Order</a></span>
					  <span><a href="user_acc/online-orders?pg=3">Order History</a></span>
					  <span><a href="sign-out">Sign Out</a></span>
					  <?php } else { ?>
					  <span><a href="sign-in">Sign In</a></span>
					  <span><a href="create-account">Create An Account</a></span>
					  <?php } ?>
					  </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </li>
        </ul>
      </div>
    </div>
    <!-- Start Mobile Menu -->
    <div class="row d-none">
      <div class="col-lg-12 d-none">
        <nav class="mobilemenu__nav">
          <ul class="meninmenu">
            <li><a href="index.php">Home</a></li>
            <li><a href="bookstore-sudila-printers-sri-lanka">Book Store</a>
                <ul>
                  <?php
				$sql_c = mysqli_query($conn, "SELECT * FROM category ORDER BY category ASC");
				while($row_c = mysqli_fetch_array($sql_c)) { ?>
                  <li><a href="bookstore-sudila-printers-sri-lanka?c=<?php echo $row_c['search_id']; ?>"><?php echo $row_c['category']; ?> </a></li>
                  <?php } ?>
                </ul>
            </li>
            <li><a href="authors-sudila-printers-sri-lanka">Authors</a></li>
            <li><a href="publishers-sudila-printers-sri-lanka">Publishers</a></li>
            <li><a href="about-sudila-printers-sri-lanka">About Us</a></li>
            <li><a href="contact-sudila-printers-sri-lanka">Contact Us</a></li>
            <li><a href="branch-network-sudila-printers-sri-lanka">Branch Network</a></li>
          </ul>
        </nav>
      </div>
    </div>
    <!-- End Mobile Menu -->
    <div class="mobile-menu d-block d-lg-none"> </div>
    <!-- Mobile Menu --> 
  </div>
</header>
<!-- //Header --> 
<!-- Start Search Popup -->
<div class="brown--color box-search-content search_active block-bg close__top">
  <form id="search_mini_form" class="minisearch" action="bookstore-sudila-printers-sri-lanka">
    <div class="field__search">
      <input type="text" placeholder="Enter Book Name Here..." name="s">
      <div class="action"> <a href="#"><i class="zmdi zmdi-search"></i></a> </div>
    </div>
  </form>
  <div class="close__wrap"> <span>close</span> </div>
</div>
<!-- End Search Popup -->