<?php		
require "session.php";
session_start();
$session = new Session();
$isLoggedAdmin = $session->isLoggedAdmin();
$isLoggedStaff = $session->isLoggedStaff();
if(!($isLoggedAdmin|| $isLoggedStaff)){
	header("Location:login.php");
	exit(); 
}else{
	if($isLoggedStaff){
		$employee_id = $_SESSION['staffId'];
		$user_type = 'staff';
		$fetch_emp_name_query = "SELECT employee_fname,employee_lname FROM employee WHERE employee_id = $employee_id";
		$fetch_emp_name_run = mysqli_query($conn, $fetch_emp_name_query);
		if(mysqli_num_rows($fetch_emp_name_run)==1){
			$fetch_emp_name_row = mysqli_fetch_array($fetch_emp_name_run);
		
			$employee_fname_auth = $fetch_emp_name_row['employee_fname'];
			$employee_lname_auth = $fetch_emp_name_row['employee_lname'];
			$user_name = $employee_fname_auth. " ". $employee_lname_auth;
		}
	}elseif($isLoggedAdmin){
		$admin_id = $_SESSION['adminId'];
		$user_type = 'admin';

	}elseif($isLoggedAdmin && $isLoggedStaff){
		header("Location:login.php");
	exit();

	}else{
		header("Location:login.php");
	exit(); 
	}
}
?>