60 lines
No EOL
3 KiB
PHP
60 lines
No EOL
3 KiB
PHP
<?php // index.php :: Primary program script, evil alien overlord, you decide.
|
|
|
|
if (file_exists('install.php')) { die("Please delete <b>install.php</b> from your Dragon Knight directory before continuing."); }
|
|
include('kernel/lib.php');
|
|
include('kernel/cookies.php');
|
|
$link = opendb();
|
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
$controlrow = mysqli_fetch_array($controlquery);
|
|
|
|
// Login (or verify) if not logged in.
|
|
$userrow = checkcookies();
|
|
if ($userrow == false) {
|
|
if (isset($_GET["do"])) {
|
|
if ($_GET["do"] == "verify") { header("Location: users.php?do=verify"); die(); }
|
|
}
|
|
header("Location: login.php?do=login"); die();
|
|
}
|
|
// Close game.
|
|
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
|
|
// Force verify if the user isn't verified yet.
|
|
if ($controlrow["verifyemail"] == 1 && $userrow["verify"] != 1) { header("Location: users.php?do=verify"); die(); }
|
|
// Block user if he/she has been banned.
|
|
if ($userrow["authlevel"] == 2) { die("Your account has been blocked. Please try back later."); }
|
|
|
|
if (isset($_GET["do"])) {
|
|
$do = explode(":",$_GET["do"]);
|
|
|
|
// Town functions.
|
|
if ($do[0] == "inn") { include('game/towns.php'); inn(); }
|
|
elseif ($do[0] == "buy") { include('game/towns.php'); buy(); }
|
|
elseif ($do[0] == "buy2") { include('game/towns.php'); buy2($do[1]); }
|
|
elseif ($do[0] == "buy3") { include('game/towns.php'); buy3($do[1]); }
|
|
elseif ($do[0] == "sell") { include('game/towns.php'); sell(); }
|
|
elseif ($do[0] == "maps") { include('game/towns.php'); maps(); }
|
|
elseif ($do[0] == "maps2") { include('game/towns.php'); maps2($do[1]); }
|
|
elseif ($do[0] == "maps3") { include('game/towns.php'); maps3($do[1]); }
|
|
elseif ($do[0] == "gotown") { include('game/towns.php'); travelto($do[1]); }
|
|
|
|
// Exploring functions.
|
|
elseif ($do[0] == "move") { include('game/explore.php'); move(); }
|
|
|
|
// Fighting functions.
|
|
elseif ($do[0] == "fight") { include('game/fight.php'); fight(); }
|
|
elseif ($do[0] == "victory") { include('game/fight.php'); victory(); }
|
|
elseif ($do[0] == "drop") { include('game/fight.php'); drop(); }
|
|
elseif ($do[0] == "dead") { include('game/fight.php'); dead(); }
|
|
|
|
// Misc functions.
|
|
elseif ($do[0] == "verify") { header("Location: users.php?do=verify"); die(); }
|
|
elseif ($do[0] == "spell") { include('game/heal.php'); healspells($do[1]); }
|
|
elseif ($do[0] == "showchar") { include('game/misc.php'); showchar(); }
|
|
elseif ($do[0] == "onlinechar") { include('game/misc.php'); onlinechar($do[1]); }
|
|
elseif ($do[0] == "showmap") { include('game/misc.php'); showmap(); }
|
|
elseif ($do[0] == "babblebox") { include('game/misc.php'); babblebox(); }
|
|
elseif ($do[0] == "ninja") { include('game/misc.php'); ninja(); }
|
|
elseif ($do[0] == "die") { header('Location: index.php?do=buy'); die(); }
|
|
|
|
} else { include('game/misc.php'); donothing(); }
|
|
|
|
?>
|