/is'; return preg_replace($sanit_pattern, '', $indata); } session_start(); require_once 'config.php'; $paths_to_check = array(); $page = basename($_SERVER['QUERY_STRING']); if (isset($_SESSION['user_id'])) { if($_SESSION['user_isAdmin'] == 1) { $nav = include_ob("$template_dir/admin_nav.html"); } else { $nav = include_ob("$template_dir/user_nav.html"); } } else { $nav = include_ob("$template_dir/navigation.html"); } if($page_dir == "global") { if(!file_exists("$page_dir/index.html")) { $page_file = "$page_dir/login.html"; } } if(empty($page)){ if(isset($_SESSION['user_id'])){ $page = 'index'; } else{ $page = 'login'; } } // Check if user is logged in if (isset($_SESSION['user_id'])) { if ($_SESSION['user_isAdmin'] == 1) { $paths_to_check[] = "pages/admin"; } $paths_to_check[] = "pages/user"; } $paths_to_check[] = "pages/global"; $page_file = "$template_dir/404.html"; foreach($paths_to_check as $page_dir){ $page_file_tmp = "$page_dir/$page.html"; if(file_exists($page_file_tmp)){ $page_file = $page_file_tmp; break; } } $page_data = include_ob($page_file); $output = file_get_contents("$template_dir/skeleton.html"); $output = str_replace('