<?php
include_once("config/config.php");
include_once("db/db.php");

init();

if(isset($_GET['page'])) {
	$page=$_GET['page'];
}
else {
	if($_SESSION['seas_user_id'] >0) {
		$page="dashboard";
	}
	else {
		$page="home";	
	}
}

$page_requested_ctrl = $application_path . "controller/" . $page . ".php";
$page_requested_view = $application_path . "view/" . $page . ".tpl.php";

if (!file_exists($page_requested_ctrl)){
	require_once($application_path . "view/page404.tpl.php");
	return false;
}
if (!file_exists($page_requested_view)){
	require_once($application_path . "view/page404.tpl.php");
	return false;
}

if(!isset($_REQUEST['sel_export'])) {
	echo "<!DOCTYPE html>";
}
require_once($page_requested_ctrl);
require_once($page_requested_view);

ob_end_flush();

?>
