<?php
	require_once('koneksi.php');
	session_start();
	if(isset($_GET['out'])){
		session_start();
		session_destroy();
		header('location: index.php');
	};
?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Toko Buku Cemerlang</title>
		<!-- for-mobile-apps -->
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="keywords" content="Toko Buku Cemerlang" />
		<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
				function hideURLbar(){ window.scrollTo(0,1); } </script>
		<!-- //for-mobile-apps -->
		<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
		<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
		<!-- font-awesome icons -->
		<link href="css/font-awesome.css" rel="stylesheet"> 
		<!-- //font-awesome icons -->
		<!-- js -->
		<script src="js/jquery-1.11.1.min.js"></script>
		<!-- //js -->
		<link href='//fonts.googleapis.com/css?family=Raleway:400,100,100italic,200,200italic,300,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic' rel='stylesheet' type='text/css'>
		<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
		<!-- start-smoth-scrolling -->
		<script type="text/javascript" src="js/move-top.js"></script>
		<script type="text/javascript" src="js/easing.js"></script>
		<script type="text/javascript">
			jQuery(document).ready(function($) {
				$(".scroll").click(function(event){		
					event.preventDefault();
					$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
				});
			});
		</script>
		<!-- start-smoth-scrolling -->
	</head>
		
	<body>
	<!-- header -->
		<div class="agileits_header">
			<div class="container">
				<div class="agile-login">
					<ul>
					<li>
					
						<?php
	                        if (isset($_SESSION['administrator'])) {
	                            echo '
	                            	<li><a href="logout_process.php">Keluar</a><br></li>
	                            </ul>
							</div>
	                            ';
	                        }
	                        elseif (isset($_SESSION['pengunjung'])){
	                        	echo '
	                        		<li><a href="singleprofile.php">Profil Anda</a><br></li>
	                            	<li><a href="logout_process.php">Keluar</a><br></li>
	                            	<li><a href="contact.php">komentar</a></li>
	                            </ul>
							</div>
							<div class="product_list_header">  
										<a href="checkout.php"><button class="w3view-cart" type="submit" name="submit" value=""><i class="fa fa-cart-arrow-down" aria-hidden="true"></i></a>
									</form>  
							</div>
	                            ';
	                        }
	                        else {
	                            echo '
		                            <li><a href="registered.php">Daftar</a></li>
		                            <li><a href="login.php">Masuk</a></li>
		                            <li><a href="contact.php">komentar</a></li>
		                        </ul>
							</div>
							<div class="product_list_header">  
										<a href="checkout.php"><button class="w3view-cart" type="submit" name="submit" value=""><i class="fa fa-cart-arrow-down" aria-hidden="true"></i></a>
									</form>  
							</div>
	                            ';
	                        }
	                    ?>
				<div class="clearfix"> </div>
			</div>
		</div>

		<div class="logo_products">
			<div class="container">
			<div class="w3ls_logo_products_left1">
					<ul class="phone_email">
						<li><img src="images/logo.png" alt="" /></li>
						
					</ul>
				</div>
				<div class="w3ls_logo_products_left">
					<h1><a href="about.php">Toko Buku Cemerlang</a></h1>
				</div>
					<?php 
						if(isset($_GET['cari'])){
							$cari 	= mysql_real_escape_string($_GET['cari']);
							$query 	= mysql_query("SELECT * FROM t_buku, t_artikel WHERE nama LIKE '$cari'");
						}
					?>
			<div class="w3l_search">
				<form action="#" method="post">
					<input type="search" name="Search" placeholder="Cari Buku" required="">
					<button type="submit" class="btn btn-default search" aria-label="Left Align">
						<i class="fa fa-search" aria-hidden="true"> </i>
					</button>
					<div class="clearfix"></div>
				</form>
			</div>
			<div class="clearfix"> </div>
			</div>
		</div>
	<!-- //header -->
	<!-- navigation -->
				<div class="navigation-agileits">
					<div class="container">
						<nav class="navbar navbar-default">
							<!-- Brand and toggle get grouped for better mobile display -->
							<div class="navbar-header nav_2">
								<button type="button" class="navbar-toggle collapsed navbar-toggle1" data-toggle="collapse" data-target="#bs-megadropdown-tabs">
									<span class="sr-only">Toggle navigation</span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
								</button>
							</div> 
							<!-- Mega Menu -->	
							<div class="collapse navbar-collapse" id="bs-megadropdown-tabs">
								<ul class="nav navbar-nav">
									
									<?php
	                                    if (isset($_SESSION['administrator'])) {
				                            echo '
												<li><a href=processbook.php>Kelola Data Buku</a><br></li>
												<li><a href=processarticle.php>Kelola Data Artikel</a><br></li>
		                                        <li><a href="processorder.php">Kelola Data Pesanan</a><br></li>	
												<li><a href="processmember.php">Kelola Data Pelanggan</a><br></li>
												<li><a href="processcomment.php">Kelola Data Komentar</a><br></li>	
	                                        ' ;
	                                    }
	                                    else {
	                                    	echo '
	                                    		<li><a href="index.php" class="act">Beranda</a></li>
												<li><a href="allbook.php">Daftar Buku</a></li>					
												<li class="dropdown">
													<a href="#" class="dropdown-toggle" data-toggle="dropdown">Kategori<b class="caret"></b></a>
													<ul class="dropdown-menu multi-column columns-3">
														<div class="row">
															<div class="multi-gd-img">
																<ul class="multi-column-dropdown">
																	<h6>Daftar Kategori</h6>
																	<li><a href="categories.php?kd=1">Agama & Rohani</a></li>
																	<li><a href="categories.php?kd=2">Kesehatan & Jasmani</a></li>
																	<li><a href="categories.php?kd=3">Buku Anak</a></li>
																	<li><a href="categories.php?kd=4">Buku Pelajaran</a></li>
																	<li><a href="categories.php?kd=5">Hobi & Keterampilan</a></li>
																	<li><a href="categories.php?kd=6">Motivasi & Bisnis</a></li>
																	<li><a href="categories.php?kd=7">Fiksi</a></li>
																	<li><a href="categories.php?kd=8">Perguruan Tinggi</a></li>
																</ul>
															</div>	
														</div>
													</ul>
												</li>
												<li class="dropdown">
													<a href="#" class="dropdown-toggle" data-toggle="dropdown">Penerbit<b class="caret"></b></a>
													<ul class="dropdown-menu multi-column columns-3">
														<div class="row">
															<div class="multi-gd-img">
																<ul class="multi-column-dropdown">
																	<h6>Daftar Penerbit</h6>
																	<li><a href="publisher.php?kd=1">Balai Pustaka</a></li>
																	<li><a href="publisher.php?kd=2">Sinar Grafika</a></li>
																	<li><a href="publisher.php?kd=3">LP3ES</a></li>
																	<li><a href="publisher.php?kd=4">Gramedia Pustaka Utama</a></li>
																	<li><a href="publisher.php?kd=5">Loko Media</a></li>
																	<li><a href="publisher.php?kd=6">Kanisius</a></li>
																	<li><a href="publisher.php?kd=7">Media Aesculapius</a></li>
																	<li><a href="publisher.php?kd=8">Elex Media Komputindo</a></li>
																</ul>
															</div>
														</div>
													</ul>
												</li>
												<li><a href="allarticle.php">Daftar Artikel</a></li>
											';
	                                    }                                   
                                    ?> 
								
								</ul>
							</div>
						</nav>
					</div>
				</div>