isValidUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { $adminEnabled = true; } } $request = findRequestedPage(); $pageId = $request[0]; if ($page = getSpecialPage($pageId)) { if (!isset($adminEnabled)) { header('WWW-Authenticate: Basic realm="GeniusDex * WEB * Admin"'); header('HTTP/1.0 401 Unauthorized'); $page = getErrorPage(401); } } else // no special page { $page = $db->getPage($pageId, !isset($adminEnabled)); } $page_is_valid = true; if ($page === false) { $page_is_valid = false; header("HTTP/1.1 404 Not Found"); $page = getErrorPage(404); } define('TRACK_STATS', true); $pagetitle = $page['title']; require_once("inc/header.php"); if (isset($page['function'])) { call_user_func($page['function'], $request); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['post_comment'])) { handlePostComment($pageId); } if (isset($_POST['comment_id']) && isset($adminEnabled)) { handleCommentStatus($pageId); } } printPage($page); if ($page['comments'] == 1) printComments($page); } require_once("inc/footer.php"); ?>