<?php 
			include("libs/uam/core/config.php");


            $page = @$_GET['page'];
            $page = !$page ? "login" : $page;
			$ext = ".php";
			
			//public page
			$page_inc_public = "page/public/" . str_replace("-", "_", $page) . $ext;
			//private page
			$page_inc_private = "page/private/" . str_replace("-", "_", $page) . $ext;
			//admin page
			$page_inc_admin = "page/admin/" . str_replace("-", "_", $page) . $ext;
			
			
			if( !file_exists($page_inc_public) && !file_exists($page_inc_private) && !file_exists($page_inc_admin) || strpos($page_inc_public . $page_inc_private . $page_inc_admin, "..")) send404();  

			//check for admin page
			if( file_exists($page_inc_admin) ) {
				
				//check if logged in and admin
				if( $user->signed && $user->data['group_id'] === '2') {
					$page_inc = $page_inc_admin;
				} else {
					$_SESSION['ErrorMsgs'][] = "No Access.";
					$page_inc = "page/public/login" . $ext;
				}
				return;
				
			}
	
			//check for private page
			if( file_exists($page_inc_private) ) {
	
				//check if logged in
				if( $user->signed ) {
					$page_inc = $page_inc_private;
				} else {
					$_SESSION['ErrorMsgs'][] = "Please login or register to access this page.";
					$page_inc = "page/public/login" . $ext;
				}
				return;
			}
			//check for public page
			if( file_exists($page_inc_public) ) {
				$page_inc = $page_inc_public;
				return;
			}
			
			
?>