$images = new Images($config['images_dir'], $config['images_url']); $localization = new Localization($home_dir . 'lang/'); $db = new mysqli($config['db_host'], $config['db_login'], $config['db_password'], $config['db_name']); $db->set_charset('utf8'); if ($db->connect_errno > 0) { $page_template = 'pages/error'; if ($config['debug_mode']) { $messages->error('Database connection error:' . $db->error_message); } } else { $globals = new SiteGlobals($db); $auth = new Authentication($db); $path = ['']; $raw_path = ''; if (isset($_GET['path'])) { $path = explode('/', trimSlashes(strtolower($_GET['path']))); $raw_path = implode('/', $path); } // select page to display switch ($path[0]) { // ADMIN SECTION case 'admin': $main_template = 'admin'; if (!isset($path[1])) { $path[1] = 'dashboard'; } switch ($path[1]) { case 'forgotten-password': $page_template = 'admin/forgot'; break; case 'reset-password':
function redirect($url, $statusCode = 303) { global $base_url; header('Location: ' . trimSlashes($base_url) . '/' . trimSlashes($url), true, $statusCode); die; }