Dragon-Knight/src/bootstrap.php

46 lines
1.3 KiB
PHP
Raw Normal View History

<?php
require_once 'lib.php';
require_once 'router.php';
require_once 'explore.php';
require_once 'heal.php';
require_once 'actions/users.php';
require_once 'actions/help.php';
require_once 'actions/towns.php';
require_once 'actions/fight.php';
require_once 'actions/forum.php';
require_once 'actions/install.php';
$uri = uri();
if (!file_exists('../.installed') && $uri[0] !== 'install') {
redirect('/install');
} elseif (file_exists(('../.installed')) && $uri[0] === 'install') {
redirect('/');
} elseif (file_exists(('../.installed')) && $uri[0] !== 'install') {
$controlrow = get_control_row();
if (!$controlrow["gameopen"]) {
display("The game is currently closed for maintanence. Please check back later.", "Game Closed");
}
// Login (or verify) if not logged in.
if (($userrow = checkcookies()) === false) {
if (!in_array($uri[0], ['login', 'register', 'verify', 'lostpassword', 'help'])) {
redirect('/login');
}
} else {
// Block user if he/she has been banned.
if ($userrow["authlevel"] === 2) {
exit("Your account has been banned.");
}
// Force verify if the user isn't verified yet.
if ($controlrow["verifyemail"] && (bool) $userrow["verify"] === false) {
redirect('/verify');
header("Location: users.php?do=verify");
exit;
}
}
}