<?php
error_reporting(0);
session_start();

if (isset($_SESSION['user_id'])) {
	if ($_SESSION['user_level'] == 1) {
		header("location:admin/index.php");
	}
}

$menu = '';

if (isset($_GET['menu'])) {
	$menu = $_GET['menu'];
}

if (!file_exists($menu . ".php")) {
	$menu = 'not_found';
}

?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="jquery-3.5.1.min.js"></script>
	<link rel="stylesheet" href="FontAwesome/css/all.min.css">
	<link rel="stylesheet" href="style-beranda.css">
	<link rel="stylesheet" href="style-detail-produk.css">
	<link rel="stylesheet" href="style-keranjang.css">
	<link rel="stylesheet" href="style-order.css">
	<link rel="stylesheet" href="style-profil.css">
	<link rel="stylesheet" href="style-edit-profil.css">
	<link rel="stylesheet" href="style-upload-bukti.css">
	<link rel="stylesheet" href="style-detail-order.css">
	<link rel="stylesheet" href="style.css">
	<title>Sewa Tenda</title>
</head>
<body>
	<nav>
		<label class="logo">Sewa Tenda</label>
		<ul>
			<li>
				<a href="index.php">Home</a>
			</li>
			<?php
			if (empty($_SESSION['user_id'])) { ?>
				<li>
					<a href="login.php">Login</a>
				</li>
			<?php } else { ?>
				<li>
					<a href="index.php?menu=keranjang">Keranjang</a>
				</li>
				<li>
					<a href="index.php?menu=order">Order</a>
				</li>
				<li>
					<a href="index.php?menu=profil">Profil</a>
				</li>
				<li>
					<a href="logout.php">Logout</a>
				</li>
			<?php } ?>
		</ul>
	</nav>

	<div class="content">
		<?php

		$menu = '';

		if (isset($_GET['menu'])) {
			$menu = $_GET['menu'];
		}

		if ($menu != '') {
			if (file_exists($menu . ".php")) {
				include $menu . ".php";
			} else {
				include 'not_found.php';
			}
		} else {
			include 'beranda.php';
		}

		?>
	</div>
</body>
</html>