54 lines
No EOL
2.9 KiB
PHP
54 lines
No EOL
2.9 KiB
PHP
<?php // Functions relative to the site
|
|
|
|
$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(PATH_GAME . 'towns.php'); inn(); }
|
|
elseif ($do[0] == "buy") { include(PATH_GAME . 'towns.php'); buy(); }
|
|
elseif ($do[0] == "buy2") { include(PATH_GAME . 'towns.php'); buy2($do[1]); }
|
|
elseif ($do[0] == "buy3") { include(PATH_GAME . 'towns.php'); buy3($do[1]); }
|
|
elseif ($do[0] == "sell") { include(PATH_GAME . 'towns.php'); sell(); }
|
|
elseif ($do[0] == "maps") { include(PATH_GAME . 'towns.php'); maps(); }
|
|
elseif ($do[0] == "maps2") { include(PATH_GAME . 'towns.php'); maps2($do[1]); }
|
|
elseif ($do[0] == "maps3") { include(PATH_GAME . 'towns.php'); maps3($do[1]); }
|
|
elseif ($do[0] == "gotown") { include(PATH_GAME . 'towns.php'); travelto($do[1]); }
|
|
|
|
// Exploring functions.
|
|
elseif ($do[0] == "move") { include(PATH_GAME . 'explore.php'); move(); }
|
|
|
|
// Fighting functions.
|
|
elseif ($do[0] == "fight") { include(PATH_GAME . 'fight.php'); fight(); }
|
|
elseif ($do[0] == "victory") { include(PATH_GAME . 'fight.php'); victory(); }
|
|
elseif ($do[0] == "drop") { include(PATH_GAME . 'fight.php'); drop(); }
|
|
elseif ($do[0] == "dead") { include(PATH_GAME . 'fight.php'); dead(); }
|
|
|
|
// Misc functions.
|
|
elseif ($do[0] == "verify") { header("Location: users.php?do=verify"); die(); }
|
|
elseif ($do[0] == "spell") { include(PATH_GAME . 'heal.php'); healspells($do[1]); }
|
|
elseif ($do[0] == "showchar") { include(PATH_GAME . 'misc.php'); showchar(); }
|
|
elseif ($do[0] == "onlinechar") { include(PATH_GAME . 'misc.php'); onlinechar($do[1]); }
|
|
elseif ($do[0] == "showmap") { include(PATH_GAME . 'misc.php');showmap(); }
|
|
elseif ($do[0] == "babblebox") { include(PATH_GAME . 'misc.php');babblebox(); }
|
|
elseif ($do[0] == "ninja") { include(PATH_GAME . 'misc.php');ninja(); }
|
|
elseif ($do[0] == "die") { header('Location: index.php?do=buy'); die(); }
|
|
|
|
} else { include(PATH_GAME . 'misc.php');donothing(); } |