<?php
session_start();

if (isset($_GET['x']) && $_GET['x'] == 'home') {
  $page = "home.php";
  include "main.php";
} elseif (isset($_GET['x']) && $_GET['x'] == 'order') {
  if ($_SESSION['level_bangblake'] == 1 ||  $_SESSION['level_bangblake'] == 3) {
    $page = "order.php";
    include "main.php";
  } else {
    $page = "home.php";
    include "main.php";
  }
} elseif (isset($_GET['x']) && $_GET['x'] == 'user') {
  if (isset($_SESSION['level_bangblake']) && $_SESSION['level_bangblake'] == 1) {
    $page = "user.php";
    include "main.php";
  } else {
    $page = "home.php";
    include "main.php";
  }
} 
 elseif (isset($_GET['x']) && $_GET['x'] == 'report') {
  if (isset($_SESSION['level_bangblake']) && $_SESSION['level_bangblake'] == 1) {
    $page = "report.php";
    include "main.php";
  } else {
    $page = "home.php";
    include "main.php";
  }
} elseif (isset($_GET['x']) && $_GET['x'] == 'menu') {
  if ($_SESSION['level_bangblake'] == 1 ||  $_SESSION['level_bangblake'] == 3) {
    $page = "menu.php";
    include "main.php";
  } else {
    $page = "home.php";
    include "main.php";
  }
} elseif (isset($_GET['x']) && $_GET['x'] == 'orderitem') {
  if ($_SESSION['level_bangblake'] == 1 ||  $_SESSION['level_bangblake'] == 3) {
    $page = "order_item.php";
    include "main.php";
  } else {
    $page = "home.php";
    include "main.php";
  }
} elseif (isset($_GET['x']) && $_GET['x'] == 'viewitem') {
  if ($_SESSION['level_bangblake'] == 1) {
    $page = "view_item.php";
    include "main.php";
  } else {
    $page = "home.php";
    include "main.php";
  }
} elseif (isset($_GET['x']) && $_GET['x'] == 'login') {
  include "login.php";
} elseif (isset($_GET['x']) && $_GET['x'] == 'logout') {
  include "proses/proses_logout.php";
} else {
  $page = "home.php";
  include "main.php";
}
