🐛 Initial PHP8 port
This commit is contained in:
parent
aa4d338c96
commit
1e8ccdf24e
20 changed files with 150 additions and 146 deletions
44
admin.php
44
admin.php
|
@ -7,7 +7,7 @@ $userrow = checkcookies();
|
||||||
if ($userrow == false) { die("Please log in to the <a href=\"../login.php?do=login\">game</a> before using the control panel."); }
|
if ($userrow == false) { die("Please log in to the <a href=\"../login.php?do=login\">game</a> before using the control panel."); }
|
||||||
if ($userrow["authlevel"] != 1) { die("You must have administrator privileges to use the control panel."); }
|
if ($userrow["authlevel"] != 1) { die("You must have administrator privileges to use the control panel."); }
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
|
|
||||||
if (isset($_GET["do"])) {
|
if (isset($_GET["do"])) {
|
||||||
$do = explode(":",$_GET["do"]);
|
$do = explode(":",$_GET["do"]);
|
||||||
|
@ -123,11 +123,11 @@ function items() {
|
||||||
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "items");
|
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "items");
|
||||||
$page = "<b><u>Edit Items</u></b><br />Click an item's name to edit it.<br /><br /><table width=\"50%\">\n";
|
$page = "<b><u>Edit Items</u></b><br />Click an item's name to edit it.<br /><br /><table width=\"50%\">\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edititem:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edititem:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
||||||
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edititem:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edititem:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
||||||
}
|
}
|
||||||
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
|
if (mysqli_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
|
||||||
$page .= "</table>";
|
$page .= "</table>";
|
||||||
admindisplay($page, "Edit Items");
|
admindisplay($page, "Edit Items");
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ function edititem($id) {
|
||||||
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
|
|
||||||
$page = <<<END
|
$page = <<<END
|
||||||
<b><u>Edit Items</u></b><br /><br />
|
<b><u>Edit Items</u></b><br /><br />
|
||||||
|
@ -201,11 +201,11 @@ function drops() {
|
||||||
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "drops");
|
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "drops");
|
||||||
$page = "<b><u>Edit Drops</u></b><br />Click an item's name to edit it.<br /><br /><table width=\"50%\">\n";
|
$page = "<b><u>Edit Drops</u></b><br />Click an item's name to edit it.<br /><br /><table width=\"50%\">\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editdrop:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editdrop:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
||||||
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editdrop:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editdrop:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
||||||
}
|
}
|
||||||
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
|
if (mysqli_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
|
||||||
$page .= "</table>";
|
$page .= "</table>";
|
||||||
admindisplay($page, "Edit Drops");
|
admindisplay($page, "Edit Drops");
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ function editdrop($id) {
|
||||||
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "drops");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "drops");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
|
|
||||||
$page = <<<END
|
$page = <<<END
|
||||||
<b><u>Edit Drops</u></b><br /><br />
|
<b><u>Edit Drops</u></b><br /><br />
|
||||||
|
@ -273,11 +273,11 @@ function towns() {
|
||||||
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "towns");
|
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "towns");
|
||||||
$page = "<b><u>Edit Towns</u></b><br />Click an town's name to edit it.<br /><br /><table width=\"50%\">\n";
|
$page = "<b><u>Edit Towns</u></b><br />Click an town's name to edit it.<br /><br /><table width=\"50%\">\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edittown:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edittown:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
||||||
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edittown:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edittown:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
||||||
}
|
}
|
||||||
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
|
if (mysqli_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
|
||||||
$page .= "</table>";
|
$page .= "</table>";
|
||||||
admindisplay($page, "Edit Towns");
|
admindisplay($page, "Edit Towns");
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ function edittown($id) {
|
||||||
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
|
|
||||||
$page = <<<END
|
$page = <<<END
|
||||||
<b><u>Edit Towns</u></b><br /><br />
|
<b><u>Edit Towns</u></b><br /><br />
|
||||||
|
@ -344,7 +344,7 @@ function monsters() {
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
|
|
||||||
$statquery = doquery("SELECT * FROM {{table}} ORDER BY level DESC LIMIT 1", "monsters");
|
$statquery = doquery("SELECT * FROM {{table}} ORDER BY level DESC LIMIT 1", "monsters");
|
||||||
$statrow = mysql_fetch_array($statquery);
|
$statrow = mysqli_fetch_array($statquery);
|
||||||
|
|
||||||
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "monsters");
|
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "monsters");
|
||||||
$page = "<b><u>Edit Monsters</u></b><br />";
|
$page = "<b><u>Edit Monsters</u></b><br />";
|
||||||
|
@ -355,11 +355,11 @@ function monsters() {
|
||||||
|
|
||||||
$page .= "Click an monster's name to edit it.<br /><br /><table width=\"50%\">\n";
|
$page .= "Click an monster's name to edit it.<br /><br /><table width=\"50%\">\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editmonster:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editmonster:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
||||||
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editmonster:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editmonster:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
||||||
}
|
}
|
||||||
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
|
if (mysqli_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
|
||||||
$page .= "</table>";
|
$page .= "</table>";
|
||||||
admindisplay($page, "Edit Monster");
|
admindisplay($page, "Edit Monster");
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ function editmonster($id) {
|
||||||
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "monsters");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "monsters");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
|
|
||||||
$page = <<<END
|
$page = <<<END
|
||||||
<b><u>Edit Monsters</u></b><br /><br />
|
<b><u>Edit Monsters</u></b><br /><br />
|
||||||
|
@ -431,11 +431,11 @@ function spells() {
|
||||||
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "spells");
|
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "spells");
|
||||||
$page = "<b><u>Edit Spells</u></b><br />Click an spell's name to edit it.<br /><br /><table width=\"50%\">\n";
|
$page = "<b><u>Edit Spells</u></b><br />Click an spell's name to edit it.<br /><br /><table width=\"50%\">\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editspell:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editspell:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
|
||||||
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editspell:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editspell:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
|
||||||
}
|
}
|
||||||
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
|
if (mysqli_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
|
||||||
$page .= "</table>";
|
$page .= "</table>";
|
||||||
admindisplay($page, "Edit Spells");
|
admindisplay($page, "Edit Spells");
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ function editspell($id) {
|
||||||
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
|
|
||||||
$page = <<<END
|
$page = <<<END
|
||||||
<b><u>Edit Spells</u></b><br /><br />
|
<b><u>Edit Spells</u></b><br /><br />
|
||||||
|
@ -495,7 +495,7 @@ END;
|
||||||
function levels() {
|
function levels() {
|
||||||
|
|
||||||
$query = doquery("SELECT id FROM {{table}} ORDER BY id DESC LIMIT 1", "levels");
|
$query = doquery("SELECT id FROM {{table}} ORDER BY id DESC LIMIT 1", "levels");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
|
|
||||||
$options = "";
|
$options = "";
|
||||||
for($i=2; $i<$row["id"]; $i++) {
|
for($i=2; $i<$row["id"]; $i++) {
|
||||||
|
@ -589,7 +589,7 @@ END;
|
||||||
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "levels");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "levels");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
$class1name = $controlrow["class1name"];
|
$class1name = $controlrow["class1name"];
|
||||||
$class2name = $controlrow["class2name"];
|
$class2name = $controlrow["class2name"];
|
||||||
|
@ -647,11 +647,11 @@ function users() {
|
||||||
$query = doquery("SELECT id,username FROM {{table}} ORDER BY id", "users");
|
$query = doquery("SELECT id,username FROM {{table}} ORDER BY id", "users");
|
||||||
$page = "<b><u>Edit Users</u></b><br />Click a username to edit the account.<br /><br /><table width=\"50%\">\n";
|
$page = "<b><u>Edit Users</u></b><br />Click a username to edit the account.<br /><br /><table width=\"50%\">\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edituser:".$row["id"]."\">".$row["username"]."</a></td></tr>\n"; $count = 2; }
|
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edituser:".$row["id"]."\">".$row["username"]."</a></td></tr>\n"; $count = 2; }
|
||||||
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edituser:".$row["id"]."\">".$row["username"]."</a></td></tr>\n"; $count = 1; }
|
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edituser:".$row["id"]."\">".$row["username"]."</a></td></tr>\n"; $count = 1; }
|
||||||
}
|
}
|
||||||
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
|
if (mysqli_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
|
||||||
$page .= "</table>";
|
$page .= "</table>";
|
||||||
admindisplay($page, "Edit Users");
|
admindisplay($page, "Edit Users");
|
||||||
|
|
||||||
|
@ -776,7 +776,7 @@ END;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
$diff1name = $controlrow["diff1name"];
|
$diff1name = $controlrow["diff1name"];
|
||||||
$diff2name = $controlrow["diff2name"];
|
$diff2name = $controlrow["diff2name"];
|
||||||
|
|
11
config.php
11
config.php
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
$dbsettings = Array(
|
$dbsettings = Array(
|
||||||
"server" => "localhost", // MySQL server name. (Default: localhost)
|
"server" => "localhost", // MySQL server name. (Default: localhost)
|
||||||
"user" => "", // MySQL username.
|
"user" => "dragonknight", // MySQL username.
|
||||||
"pass" => "", // MySQL password.
|
"pass" => "dragonknight", // MySQL password.
|
||||||
"name" => "", // MySQL database name.
|
"name" => "dragonknight", // MySQL database name.
|
||||||
"prefix" => "dk", // Prefix for table names. (Default: dk)
|
"prefix" => "dk", // Prefix for table names. (Default: dk)
|
||||||
"secretword" => ""); // Secret word used when hashing information for cookies.
|
"secretword" => "koboldkipu"); // Secret word used when hashing information for cookies.
|
||||||
|
?>
|
||||||
?>
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ function checkcookies() {
|
||||||
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
||||||
$theuser = explode(" ",$_COOKIE["dkgame"]);
|
$theuser = explode(" ",$_COOKIE["dkgame"]);
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE username='$theuser[1]'", "users");
|
$query = doquery("SELECT * FROM {{table}} WHERE username='$theuser[1]'", "users");
|
||||||
if (mysql_num_rows($query) != 1) { die("Invalid cookie data (Error 1). Please clear cookies and log in again."); }
|
if (mysqli_num_rows($query) != 1) { die("Invalid cookie data (Error 1). Please clear cookies and log in again."); }
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
if ($row["id"] != $theuser[0]) { die("Invalid cookie data (Error 2). Please clear cookies and log in again."); }
|
if ($row["id"] != $theuser[0]) { die("Invalid cookie data (Error 2). Please clear cookies and log in again."); }
|
||||||
if (md5($row["password"] . "--" . $dbsettings["secretword"]) !== $theuser[2]) { die("Invalid cookie data (Error 3). Please clear cookies and log in again."); }
|
if (md5($row["password"] . "--" . $dbsettings["secretword"]) !== $theuser[2]) { die("Invalid cookie data (Error 3). Please clear cookies and log in again."); }
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ function move() {
|
||||||
if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
|
if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
|
||||||
|
|
||||||
$townquery = doquery("SELECT id FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "towns");
|
$townquery = doquery("SELECT id FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) > 0) {
|
if (mysqli_num_rows($townquery) > 0) {
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
include('towns.php');
|
include('towns.php');
|
||||||
travelto($townrow["id"], false);
|
travelto($townrow["id"], false);
|
||||||
die();
|
die();
|
||||||
|
|
18
fight.php
18
fight.php
|
@ -10,7 +10,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
$pagearray["magiclist"] = "";
|
$pagearray["magiclist"] = "";
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$spellquery = doquery("SELECT id,name FROM {{table}}", "spells");
|
$spellquery = doquery("SELECT id,name FROM {{table}}", "spells");
|
||||||
while ($spellrow = mysql_fetch_array($spellquery)) {
|
while ($spellrow = mysqli_fetch_array($spellquery)) {
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach ($userspells as $a => $b) {
|
foreach ($userspells as $a => $b) {
|
||||||
if ($b == $spellrow["id"]) { $spell = true; }
|
if ($b == $spellrow["id"]) { $spell = true; }
|
||||||
|
@ -38,7 +38,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
|
|
||||||
// Pick a monster.
|
// Pick a monster.
|
||||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE level>='$minlevel' AND level<='$maxlevel' ORDER BY RAND() LIMIT 1", "monsters");
|
$monsterquery = doquery("SELECT * FROM {{table}} WHERE level>='$minlevel' AND level<='$maxlevel' ORDER BY RAND() LIMIT 1", "monsters");
|
||||||
$monsterrow = mysql_fetch_array($monsterquery);
|
$monsterrow = mysqli_fetch_array($monsterquery);
|
||||||
$userrow["currentmonster"] = $monsterrow["id"];
|
$userrow["currentmonster"] = $monsterrow["id"];
|
||||||
$userrow["currentmonsterhp"] = rand((($monsterrow["maxhp"]/5)*4),$monsterrow["maxhp"]);
|
$userrow["currentmonsterhp"] = rand((($monsterrow["maxhp"]/5)*4),$monsterrow["maxhp"]);
|
||||||
if ($userrow["difficulty"] == 2) { $userrow["currentmonsterhp"] = ceil($userrow["currentmonsterhp"] * $controlrow["diff2mod"]); }
|
if ($userrow["difficulty"] == 2) { $userrow["currentmonsterhp"] = ceil($userrow["currentmonsterhp"] * $controlrow["diff2mod"]); }
|
||||||
|
@ -56,7 +56,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
|
|
||||||
// Next, get the monster statistics.
|
// Next, get the monster statistics.
|
||||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
||||||
$monsterrow = mysql_fetch_array($monsterquery);
|
$monsterrow = mysqli_fetch_array($monsterquery);
|
||||||
$pagearray["monstername"] = $monsterrow["name"];
|
$pagearray["monstername"] = $monsterrow["name"];
|
||||||
|
|
||||||
// Do run stuff.
|
// Do run stuff.
|
||||||
|
@ -185,7 +185,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
if ($pickedspell == 0) { display("You must select a spell first. Please go back and try again.", "Error"); die(); }
|
if ($pickedspell == 0) { display("You must select a spell first. Please go back and try again.", "Error"); die(); }
|
||||||
|
|
||||||
$newspellquery = doquery("SELECT * FROM {{table}} WHERE id='$pickedspell' LIMIT 1", "spells");
|
$newspellquery = doquery("SELECT * FROM {{table}} WHERE id='$pickedspell' LIMIT 1", "spells");
|
||||||
$newspellrow = mysql_fetch_array($newspellquery);
|
$newspellrow = mysqli_fetch_array($newspellquery);
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach($userspells as $a => $b) {
|
foreach($userspells as $a => $b) {
|
||||||
if ($b == $pickedspell) { $spell = true; }
|
if ($b == $pickedspell) { $spell = true; }
|
||||||
|
@ -359,7 +359,7 @@ function victory() {
|
||||||
if ($userrow["currentfight"] == 0) { header("Location: index.php"); die(); }
|
if ($userrow["currentfight"] == 0) { header("Location: index.php"); die(); }
|
||||||
|
|
||||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
||||||
$monsterrow = mysql_fetch_array($monsterquery);
|
$monsterrow = mysqli_fetch_array($monsterquery);
|
||||||
|
|
||||||
$exp = rand((($monsterrow["maxexp"]/6)*5),$monsterrow["maxexp"]);
|
$exp = rand((($monsterrow["maxexp"]/6)*5),$monsterrow["maxexp"]);
|
||||||
if ($exp < 1) { $exp = 1; }
|
if ($exp < 1) { $exp = 1; }
|
||||||
|
@ -375,7 +375,7 @@ function victory() {
|
||||||
if ($userrow["gold"] + $gold < 16777215) { $newgold = $userrow["gold"] + $gold; $warngold = ""; } else { $newgold = $userrow["gold"]; $gold = 0; $warngold = "You have maxed out your experience points."; }
|
if ($userrow["gold"] + $gold < 16777215) { $newgold = $userrow["gold"] + $gold; $warngold = ""; } else { $newgold = $userrow["gold"]; $gold = 0; $warngold = "You have maxed out your experience points."; }
|
||||||
|
|
||||||
$levelquery = doquery("SELECT * FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$levelquery = doquery("SELECT * FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
||||||
if (mysql_num_rows($levelquery) == 1) { $levelrow = mysql_fetch_array($levelquery); }
|
if (mysqli_num_rows($levelquery) == 1) { $levelrow = mysqli_fetch_array($levelquery); }
|
||||||
|
|
||||||
if ($userrow["level"] < 100) {
|
if ($userrow["level"] < 100) {
|
||||||
if ($newexp >= $levelrow[$userrow["charclass"]."_exp"]) {
|
if ($newexp >= $levelrow[$userrow["charclass"]."_exp"]) {
|
||||||
|
@ -411,7 +411,7 @@ function victory() {
|
||||||
|
|
||||||
if (rand(1,30) == 1) {
|
if (rand(1,30) == 1) {
|
||||||
$dropquery = doquery("SELECT * FROM {{table}} WHERE mlevel <= '".$monsterrow["level"]."' ORDER BY RAND() LIMIT 1", "drops");
|
$dropquery = doquery("SELECT * FROM {{table}} WHERE mlevel <= '".$monsterrow["level"]."' ORDER BY RAND() LIMIT 1", "drops");
|
||||||
$droprow = mysql_fetch_array($dropquery);
|
$droprow = mysqli_fetch_array($dropquery);
|
||||||
$dropcode = "dropcode='".$droprow["id"]."',";
|
$dropcode = "dropcode='".$droprow["id"]."',";
|
||||||
$page .= "This monster has dropped an item. <a href=\"index.php?do=drop\">Click here</a> to reveal and equip the item, or you may also move on and continue <a href=\"index.php\">exploring</a>.";
|
$page .= "This monster has dropped an item. <a href=\"index.php?do=drop\">Click here</a> to reveal and equip the item, or you may also move on and continue <a href=\"index.php\">exploring</a>.";
|
||||||
} else {
|
} else {
|
||||||
|
@ -437,7 +437,7 @@ function drop() {
|
||||||
if ($userrow["dropcode"] == 0) { header("Location: index.php"); die(); }
|
if ($userrow["dropcode"] == 0) { header("Location: index.php"); die(); }
|
||||||
|
|
||||||
$dropquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["dropcode"]."' LIMIT 1", "drops");
|
$dropquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["dropcode"]."' LIMIT 1", "drops");
|
||||||
$droprow = mysql_fetch_array($dropquery);
|
$droprow = mysqli_fetch_array($dropquery);
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ function drop() {
|
||||||
if ($userrow["slot".$slot."id"] != 0) {
|
if ($userrow["slot".$slot."id"] != 0) {
|
||||||
|
|
||||||
$slotquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["slot".$slot."id"]."' LIMIT 1", "drops");
|
$slotquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["slot".$slot."id"]."' LIMIT 1", "drops");
|
||||||
$slotrow = mysql_fetch_array($slotquery);
|
$slotrow = mysqli_fetch_array($slotquery);
|
||||||
|
|
||||||
$old1 = explode(",",$slotrow["attribute1"]);
|
$old1 = explode(",",$slotrow["attribute1"]);
|
||||||
if ($slotrow["attribute2"] != "X") { $old2 = explode(",",$slotrow["attribute2"]); } else { $old2 = array(0=>"maxhp",1=>0); }
|
if ($slotrow["attribute2"] != "X") { $old2 = explode(",",$slotrow["attribute2"]); } else { $old2 = array(0=>"maxhp",1=>0); }
|
||||||
|
|
10
forum.php
10
forum.php
|
@ -6,7 +6,7 @@ $link = opendb();
|
||||||
$userrow = checkcookies();
|
$userrow = checkcookies();
|
||||||
if ($userrow == false) { display("The forum is for registered players only.", "Forum"); die(); }
|
if ($userrow == false) { display("The forum is for registered players only.", "Forum"); die(); }
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
|
|
||||||
// Close game.
|
// Close game.
|
||||||
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
|
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
|
||||||
|
@ -30,10 +30,10 @@ function donothing($start=0) {
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE parent='0' ORDER BY newpostdate DESC LIMIT 20", "forum");
|
$query = doquery("SELECT * FROM {{table}} WHERE parent='0' ORDER BY newpostdate DESC LIMIT 20", "forum");
|
||||||
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><th colspan=\"3\" style=\"background-color:#dddddd;\"><center><a href=\"forum.php?do=new\">New Thread</a></center></th></tr><tr><th width=\"50%\" style=\"background-color:#dddddd;\">Thread</th><th width=\"10%\" style=\"background-color:#dddddd;\">Replies</th><th style=\"background-color:#dddddd;\">Last Post</th></tr>\n";
|
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><th colspan=\"3\" style=\"background-color:#dddddd;\"><center><a href=\"forum.php?do=new\">New Thread</a></center></th></tr><tr><th width=\"50%\" style=\"background-color:#dddddd;\">Thread</th><th width=\"10%\" style=\"background-color:#dddddd;\">Replies</th><th style=\"background-color:#dddddd;\">Last Post</th></tr>\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
if (mysql_num_rows($query) == 0) {
|
if (mysqli_num_rows($query) == 0) {
|
||||||
$page .= "<tr><td style=\"background-color:#ffffff;\" colspan=\"3\"><b>No threads in forum.</b></td></tr>\n";
|
$page .= "<tr><td style=\"background-color:#ffffff;\" colspan=\"3\"><b>No threads in forum.</b></td></tr>\n";
|
||||||
} else {
|
} else {
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) {
|
if ($count == 1) {
|
||||||
$page .= "<tr><td style=\"background-color:#ffffff;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#ffffff;\">".$row["replies"]."</td><td style=\"background-color:#ffffff;\">".$row["newpostdate"]."</td></tr>\n";
|
$page .= "<tr><td style=\"background-color:#ffffff;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#ffffff;\">".$row["replies"]."</td><td style=\"background-color:#ffffff;\">".$row["newpostdate"]."</td></tr>\n";
|
||||||
$count = 2;
|
$count = 2;
|
||||||
|
@ -53,10 +53,10 @@ function showthread($id, $start) {
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' OR parent='$id' ORDER BY id LIMIT $start,15", "forum");
|
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' OR parent='$id' ORDER BY id LIMIT $start,15", "forum");
|
||||||
$query2 = doquery("SELECT title FROM {{table}} WHERE id='$id' LIMIT 1", "forum");
|
$query2 = doquery("SELECT title FROM {{table}} WHERE id='$id' LIMIT 1", "forum");
|
||||||
$row2 = mysql_fetch_array($query2);
|
$row2 = mysqli_fetch_array($query2);
|
||||||
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"forum.php\">Forum</a> :: ".$row2["title"]."</b></td></tr>\n";
|
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"forum.php\">Forum</a> :: ".$row2["title"]."</b></td></tr>\n";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
if ($count == 1) {
|
if ($count == 1) {
|
||||||
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
||||||
$count = 2;
|
$count = 2;
|
||||||
|
|
2
heal.php
2
heal.php
|
@ -6,7 +6,7 @@ function healspells($id) {
|
||||||
|
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$spellquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
|
$spellquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
|
||||||
$spellrow = mysql_fetch_array($spellquery);
|
$spellrow = mysqli_fetch_array($spellquery);
|
||||||
|
|
||||||
// All the various ways to error out.
|
// All the various ways to error out.
|
||||||
$spell = false;
|
$spell = false;
|
||||||
|
|
2
help.php
2
help.php
|
@ -2,7 +2,7 @@
|
||||||
include('lib.php');
|
include('lib.php');
|
||||||
$link = opendb();
|
$link = opendb();
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
ob_start("ob_gzhandler");
|
ob_start("ob_gzhandler");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
include('lib.php');
|
include('lib.php');
|
||||||
$link = opendb();
|
$link = opendb();
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
ob_start("ob_gzhandler");
|
ob_start("ob_gzhandler");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ a:hover {
|
||||||
<?
|
<?
|
||||||
$count = 1;
|
$count = 1;
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "items");
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["type"] == 1) { $image = "weapon"; $power = "Attack"; } elseif ($itemsrow["type"] == 2) { $image = "armor"; $power = "Defense"; } else { $image = "shield"; $power = "Defense"; }
|
if ($itemsrow["type"] == 1) { $image = "weapon"; $power = "Attack"; } elseif ($itemsrow["type"] == 2) { $image = "armor"; $power = "Defense"; } else { $image = "shield"; $power = "Defense"; }
|
||||||
if ($itemsrow["special"] != "X") {
|
if ($itemsrow["special"] != "X") {
|
||||||
|
@ -111,7 +111,7 @@ while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
||||||
<?
|
<?
|
||||||
$count = 1;
|
$count = 1;
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "drops");
|
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "drops");
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["attribute1"] != "X") {
|
if ($itemsrow["attribute1"] != "X") {
|
||||||
$special1 = explode(",",$itemsrow["attribute1"]);
|
$special1 = explode(",",$itemsrow["attribute1"]);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
include('lib.php');
|
include('lib.php');
|
||||||
$link = opendb();
|
$link = opendb();
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
ob_start("ob_gzhandler");
|
ob_start("ob_gzhandler");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -83,10 +83,10 @@ $count = 1;
|
||||||
$itemsquery = doquery("SELECT id,1_exp,1_hp,1_mp,1_tp,1_strength,1_dexterity,1_spells FROM {{table}} ORDER BY id", "levels");
|
$itemsquery = doquery("SELECT id,1_exp,1_hp,1_mp,1_tp,1_strength,1_dexterity,1_spells FROM {{table}} ORDER BY id", "levels");
|
||||||
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
||||||
$spells = array();
|
$spells = array();
|
||||||
while ($spellsrow = mysql_fetch_array($spellsquery)) {
|
while ($spellsrow = mysqli_fetch_array($spellsquery)) {
|
||||||
$spells[$spellsrow["id"]] = $spellsrow;
|
$spells[$spellsrow["id"]] = $spellsrow;
|
||||||
}
|
}
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["1_spells"] != 0) { $spell = $spells[$itemsrow["1_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
if ($itemsrow["1_spells"] != 0) { $spell = $spells[$itemsrow["1_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
||||||
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["1_exp"])."</td><td $color width=\"12%\">".$itemsrow["1_hp"]."</td><td $color width=\"12%\">".$itemsrow["1_mp"]."</td><td $color width=\"12%\">".$itemsrow["1_tp"]."</td><td $color width=\"12%\">".$itemsrow["1_strength"]."</td><td $color width=\"12%\">".$itemsrow["1_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["1_exp"])."</td><td $color width=\"12%\">".$itemsrow["1_hp"]."</td><td $color width=\"12%\">".$itemsrow["1_mp"]."</td><td $color width=\"12%\">".$itemsrow["1_tp"]."</td><td $color width=\"12%\">".$itemsrow["1_strength"]."</td><td $color width=\"12%\">".$itemsrow["1_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
||||||
|
@ -102,10 +102,10 @@ $count = 1;
|
||||||
$itemsquery = doquery("SELECT id,2_exp,2_hp,2_mp,2_tp,2_strength,2_dexterity,2_spells FROM {{table}} ORDER BY id", "levels");
|
$itemsquery = doquery("SELECT id,2_exp,2_hp,2_mp,2_tp,2_strength,2_dexterity,2_spells FROM {{table}} ORDER BY id", "levels");
|
||||||
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
||||||
$spells = array();
|
$spells = array();
|
||||||
while ($spellsrow = mysql_fetch_array($spellsquery)) {
|
while ($spellsrow = mysqli_fetch_array($spellsquery)) {
|
||||||
$spells[$spellsrow["id"]] = $spellsrow;
|
$spells[$spellsrow["id"]] = $spellsrow;
|
||||||
}
|
}
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["2_spells"] != 0) { $spell = $spells[$itemsrow["2_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
if ($itemsrow["2_spells"] != 0) { $spell = $spells[$itemsrow["2_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
||||||
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["2_exp"])."</td><td $color width=\"12%\">".$itemsrow["2_hp"]."</td><td $color width=\"12%\">".$itemsrow["2_mp"]."</td><td $color width=\"12%\">".$itemsrow["2_tp"]."</td><td $color width=\"12%\">".$itemsrow["2_strength"]."</td><td $color width=\"12%\">".$itemsrow["2_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["2_exp"])."</td><td $color width=\"12%\">".$itemsrow["2_hp"]."</td><td $color width=\"12%\">".$itemsrow["2_mp"]."</td><td $color width=\"12%\">".$itemsrow["2_tp"]."</td><td $color width=\"12%\">".$itemsrow["2_strength"]."</td><td $color width=\"12%\">".$itemsrow["2_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
||||||
|
@ -121,10 +121,10 @@ $count = 1;
|
||||||
$itemsquery = doquery("SELECT id,3_exp,3_hp,3_mp,3_tp,3_strength,3_dexterity,3_spells FROM {{table}} ORDER BY id", "levels");
|
$itemsquery = doquery("SELECT id,3_exp,3_hp,3_mp,3_tp,3_strength,3_dexterity,3_spells FROM {{table}} ORDER BY id", "levels");
|
||||||
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
||||||
$spells = array();
|
$spells = array();
|
||||||
while ($spellsrow = mysql_fetch_array($spellsquery)) {
|
while ($spellsrow = mysqli_fetch_array($spellsquery)) {
|
||||||
$spells[$spellsrow["id"]] = $spellsrow;
|
$spells[$spellsrow["id"]] = $spellsrow;
|
||||||
}
|
}
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["3_spells"] != 0) { $spell = $spells[$itemsrow["3_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
if ($itemsrow["3_spells"] != 0) { $spell = $spells[$itemsrow["3_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
||||||
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["3_exp"])."</td><td $color width=\"12%\">".$itemsrow["3_hp"]."</td><td $color width=\"12%\">".$itemsrow["3_mp"]."</td><td $color width=\"12%\">".$itemsrow["3_tp"]."</td><td $color width=\"12%\">".$itemsrow["3_strength"]."</td><td $color width=\"12%\">".$itemsrow["3_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["3_exp"])."</td><td $color width=\"12%\">".$itemsrow["3_hp"]."</td><td $color width=\"12%\">".$itemsrow["3_mp"]."</td><td $color width=\"12%\">".$itemsrow["3_tp"]."</td><td $color width=\"12%\">".$itemsrow["3_strength"]."</td><td $color width=\"12%\">".$itemsrow["3_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
include('lib.php');
|
include('lib.php');
|
||||||
$link = opendb();
|
$link = opendb();
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
ob_start("ob_gzhandler");
|
ob_start("ob_gzhandler");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ a:hover {
|
||||||
<?
|
<?
|
||||||
$count = 1;
|
$count = 1;
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "monsters");
|
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "monsters");
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["immune"] == 0) { $immune = "<span class=\"light\">None</span>"; } elseif ($itemsrow["immune"] == 1) { $immune = "Hurt"; } else { $immune = "Hurt & Sleep"; }
|
if ($itemsrow["immune"] == 0) { $immune = "<span class=\"light\">None</span>"; } elseif ($itemsrow["immune"] == 1) { $immune = "Hurt"; } else { $immune = "Hurt & Sleep"; }
|
||||||
echo "<tr><td $color width=\"30%\">".$itemsrow["name"]."</td><td $color width=\"10%\">".$itemsrow["maxhp"]."</td><td $color width=\"10%\">".$itemsrow["maxdam"]."</td><td $color width=\"10%\">".$itemsrow["armor"]."</td><td $color width=\"10%\">".$itemsrow["level"]."</td><td $color width=\"10%\">".$itemsrow["maxexp"]."</td><td $color width=\"10%\">".$itemsrow["maxgold"]."</td><td $color width=\"20%\">$immune</td></tr>\n";
|
echo "<tr><td $color width=\"30%\">".$itemsrow["name"]."</td><td $color width=\"10%\">".$itemsrow["maxhp"]."</td><td $color width=\"10%\">".$itemsrow["maxdam"]."</td><td $color width=\"10%\">".$itemsrow["armor"]."</td><td $color width=\"10%\">".$itemsrow["level"]."</td><td $color width=\"10%\">".$itemsrow["maxexp"]."</td><td $color width=\"10%\">".$itemsrow["maxgold"]."</td><td $color width=\"20%\">$immune</td></tr>\n";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
include('lib.php');
|
include('lib.php');
|
||||||
$link = opendb();
|
$link = opendb();
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
ob_start("ob_gzhandler");
|
ob_start("ob_gzhandler");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ a:hover {
|
||||||
<?
|
<?
|
||||||
$count = 1;
|
$count = 1;
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
||||||
if ($itemsrow["type"] == 1) { $type = "Heal"; }
|
if ($itemsrow["type"] == 1) { $type = "Heal"; }
|
||||||
elseif ($itemsrow["type"] == 2) { $type = "Hurt"; }
|
elseif ($itemsrow["type"] == 2) { $type = "Hurt"; }
|
||||||
|
|
22
index.php
22
index.php
|
@ -5,7 +5,7 @@ include('lib.php');
|
||||||
include('cookies.php');
|
include('cookies.php');
|
||||||
$link = opendb();
|
$link = opendb();
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
|
|
||||||
// Login (or verify) if not logged in.
|
// Login (or verify) if not logged in.
|
||||||
$userrow = checkcookies();
|
$userrow = checkcookies();
|
||||||
|
@ -80,13 +80,13 @@ function dotown() { // Spit out the main town page.
|
||||||
global $userrow, $controlrow, $numqueries;
|
global $userrow, $controlrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) == 0) { display("There is an error with your user account, or with the town data. Please try again.","Error"); }
|
if (mysqli_num_rows($townquery) == 0) { display("There is an error with your user account, or with the town data. Please try again.","Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
|
|
||||||
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
|
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
|
||||||
if ($controlrow["shownews"] == 1) {
|
if ($controlrow["shownews"] == 1) {
|
||||||
$newsquery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 1", "news");
|
$newsquery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 1", "news");
|
||||||
$newsrow = mysql_fetch_array($newsquery);
|
$newsrow = mysqli_fetch_array($newsquery);
|
||||||
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
|
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
|
||||||
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br />".nl2br($newsrow["content"]);
|
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br />".nl2br($newsrow["content"]);
|
||||||
$townrow["news"] .= "</td></tr></table>\n";
|
$townrow["news"] .= "</td></tr></table>\n";
|
||||||
|
@ -96,8 +96,8 @@ function dotown() { // Spit out the main town page.
|
||||||
if ($controlrow["showonline"] == 1) {
|
if ($controlrow["showonline"] == 1) {
|
||||||
$onlinequery = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' ORDER BY charname", "users");
|
$onlinequery = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' ORDER BY charname", "users");
|
||||||
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
|
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
|
||||||
$townrow["whosonline"] .= "There are <b>" . mysql_num_rows($onlinequery) . "</b> user(s) online within the last 10 minutes: ";
|
$townrow["whosonline"] .= "There are <b>" . mysqli_num_rows($onlinequery) . "</b> user(s) online within the last 10 minutes: ";
|
||||||
while ($onlinerow = mysql_fetch_array($onlinequery)) { $townrow["whosonline"] .= "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["charname"]."</a>" . ", "; }
|
while ($onlinerow = mysqli_fetch_array($onlinequery)) { $townrow["whosonline"] .= "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["charname"]."</a>" . ", "; }
|
||||||
$townrow["whosonline"] = rtrim($townrow["whosonline"], ", ");
|
$townrow["whosonline"] = rtrim($townrow["whosonline"], ", ");
|
||||||
$townrow["whosonline"] .= "</td></tr></table>\n";
|
$townrow["whosonline"] .= "</td></tr></table>\n";
|
||||||
} else { $townrow["whosonline"] = ""; }
|
} else { $townrow["whosonline"] = ""; }
|
||||||
|
@ -157,7 +157,7 @@ function showchar() {
|
||||||
} else { $userrow["plusgold"] = ""; }
|
} else { $userrow["plusgold"] = ""; }
|
||||||
|
|
||||||
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
||||||
$levelrow = mysql_fetch_array($levelquery);
|
$levelrow = mysqli_fetch_array($levelquery);
|
||||||
if ($userrow["level"] < 99) { $userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]); } else { $userrow["nextlevel"] = "<span class=\"light\">None</span>"; }
|
if ($userrow["level"] < 99) { $userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]); } else { $userrow["nextlevel"] = "<span class=\"light\">None</span>"; }
|
||||||
|
|
||||||
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
||||||
|
@ -171,7 +171,7 @@ function showchar() {
|
||||||
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
|
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$userrow["magiclist"] = "";
|
$userrow["magiclist"] = "";
|
||||||
while ($spellrow = mysql_fetch_array($spellquery)) {
|
while ($spellrow = mysqli_fetch_array($spellquery)) {
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach($userspells as $a => $b) {
|
foreach($userspells as $a => $b) {
|
||||||
if ($b == $spellrow["id"]) { $spell = true; }
|
if ($b == $spellrow["id"]) { $spell = true; }
|
||||||
|
@ -199,7 +199,7 @@ function onlinechar($id) {
|
||||||
|
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
$userquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
||||||
if (mysql_num_rows($userquery) == 1) { $userrow = mysql_fetch_array($userquery); } else { display("No such user.", "Error"); }
|
if (mysqli_num_rows($userquery) == 1) { $userrow = mysqli_fetch_array($userquery); } else { display("No such user.", "Error"); }
|
||||||
|
|
||||||
// Format various userrow stuffs.
|
// Format various userrow stuffs.
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
|
@ -216,7 +216,7 @@ function onlinechar($id) {
|
||||||
} else { $userrow["plusgold"] = ""; }
|
} else { $userrow["plusgold"] = ""; }
|
||||||
|
|
||||||
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
||||||
$levelrow = mysql_fetch_array($levelquery);
|
$levelrow = mysqli_fetch_array($levelquery);
|
||||||
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
|
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
|
||||||
|
|
||||||
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
||||||
|
@ -264,7 +264,7 @@ function babblebox() {
|
||||||
$babblebox = array("content"=>"");
|
$babblebox = array("content"=>"");
|
||||||
$bg = 1;
|
$bg = 1;
|
||||||
$babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 20", "babble");
|
$babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 20", "babble");
|
||||||
while ($babblerow = mysql_fetch_array($babblequery)) {
|
while ($babblerow = mysqli_fetch_array($babblequery)) {
|
||||||
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
|
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
|
||||||
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
|
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
|
||||||
$babblebox["content"] = $new . $babblebox["content"];
|
$babblebox["content"] = $new . $babblebox["content"];
|
||||||
|
|
28
install.php
28
install.php
|
@ -20,7 +20,7 @@ function dobatch ($p_query) {
|
||||||
foreach ($query_split as $command_line) {
|
foreach ($query_split as $command_line) {
|
||||||
$command_line = trim($command_line);
|
$command_line = trim($command_line);
|
||||||
if ($command_line != '') {
|
if ($command_line != '') {
|
||||||
$query_result = mysql_query($command_line);
|
$query_result = mysqli_query(opendb(), $command_line);
|
||||||
if ($query_result == 0) {
|
if ($query_result == 0) {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
@ -83,7 +83,7 @@ CREATE TABLE `$babble` (
|
||||||
`author` varchar(30) NOT NULL default '',
|
`author` varchar(30) NOT NULL default '',
|
||||||
`babble` varchar(120) NOT NULL default '',
|
`babble` varchar(120) NOT NULL default '',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Babble Box table created.<br />"; } else { echo "Error creating Babble Box table."; }
|
if (dobatch($query) == 1) { echo "Babble Box table created.<br />"; } else { echo "Error creating Babble Box table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -113,7 +113,7 @@ CREATE TABLE `$control` (
|
||||||
`showbabble` tinyint(3) unsigned NOT NULL default '0',
|
`showbabble` tinyint(3) unsigned NOT NULL default '0',
|
||||||
`showonline` tinyint(3) unsigned NOT NULL default '0',
|
`showonline` tinyint(3) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
|
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Control table created.<br />"; } else { echo "Error creating Control table."; }
|
if (dobatch($query) == 1) { echo "Control table created.<br />"; } else { echo "Error creating Control table."; }
|
||||||
|
@ -134,7 +134,7 @@ CREATE TABLE `$drops` (
|
||||||
`attribute1` varchar(30) NOT NULL default '',
|
`attribute1` varchar(30) NOT NULL default '',
|
||||||
`attribute2` varchar(30) NOT NULL default '',
|
`attribute2` varchar(30) NOT NULL default '',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Drops table created.<br />"; } else { echo "Error creating Drops table."; }
|
if (dobatch($query) == 1) { echo "Drops table created.<br />"; } else { echo "Error creating Drops table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -189,7 +189,7 @@ CREATE TABLE `$forum` (
|
||||||
`title` varchar(100) NOT NULL default '',
|
`title` varchar(100) NOT NULL default '',
|
||||||
`content` text NOT NULL,
|
`content` text NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Forum table created.<br />"; } else { echo "Error creating Forum table."; }
|
if (dobatch($query) == 1) { echo "Forum table created.<br />"; } else { echo "Error creating Forum table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -203,7 +203,7 @@ CREATE TABLE `$items` (
|
||||||
`attribute` smallint(5) unsigned NOT NULL default '0',
|
`attribute` smallint(5) unsigned NOT NULL default '0',
|
||||||
`special` varchar(50) NOT NULL default '',
|
`special` varchar(50) NOT NULL default '',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Items table created.<br />"; } else { echo "Error creating Items table."; }
|
if (dobatch($query) == 1) { echo "Items table created.<br />"; } else { echo "Error creating Items table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -273,7 +273,7 @@ CREATE TABLE `$levels` (
|
||||||
`3_dexterity` smallint(5) unsigned NOT NULL default '0',
|
`3_dexterity` smallint(5) unsigned NOT NULL default '0',
|
||||||
`3_spells` tinyint(3) unsigned NOT NULL default '0',
|
`3_spells` tinyint(3) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Levels table created.<br />"; } else { echo "Error creating Levels table."; }
|
if (dobatch($query) == 1) { echo "Levels table created.<br />"; } else { echo "Error creating Levels table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -397,7 +397,7 @@ CREATE TABLE `$monsters` (
|
||||||
`maxgold` smallint(5) unsigned NOT NULL default '0',
|
`maxgold` smallint(5) unsigned NOT NULL default '0',
|
||||||
`immune` tinyint(3) unsigned NOT NULL default '0',
|
`immune` tinyint(3) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Monsters table created.<br />"; } else { echo "Error creating Monsters table."; }
|
if (dobatch($query) == 1) { echo "Monsters table created.<br />"; } else { echo "Error creating Monsters table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -566,7 +566,7 @@ CREATE TABLE `$news` (
|
||||||
`postdate` datetime NOT NULL default '0000-00-00 00:00:00',
|
`postdate` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
`content` text NOT NULL,
|
`content` text NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "News table created.<br />"; } else { echo "Error creating News table."; }
|
if (dobatch($query) == 1) { echo "News table created.<br />"; } else { echo "Error creating News table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -585,7 +585,7 @@ CREATE TABLE `$spells` (
|
||||||
`attribute` smallint(5) unsigned NOT NULL default '0',
|
`attribute` smallint(5) unsigned NOT NULL default '0',
|
||||||
`type` smallint(5) unsigned NOT NULL default '0',
|
`type` smallint(5) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Spells table created.<br />"; } else { echo "Error creating Spells table."; }
|
if (dobatch($query) == 1) { echo "Spells table created.<br />"; } else { echo "Error creating Spells table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -627,7 +627,7 @@ CREATE TABLE `$towns` (
|
||||||
`travelpoints` smallint(5) unsigned NOT NULL default '0',
|
`travelpoints` smallint(5) unsigned NOT NULL default '0',
|
||||||
`itemslist` text NOT NULL,
|
`itemslist` text NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Towns table created.<br />"; } else { echo "Error creating Towns table."; }
|
if (dobatch($query) == 1) { echo "Towns table created.<br />"; } else { echo "Error creating Towns table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -701,7 +701,7 @@ CREATE TABLE `$users` (
|
||||||
`spells` varchar(50) NOT NULL default '0',
|
`spells` varchar(50) NOT NULL default '0',
|
||||||
`towns` varchar(50) NOT NULL default '0',
|
`towns` varchar(50) NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) TYPE=MyISAM;
|
);
|
||||||
END;
|
END;
|
||||||
if (dobatch($query) == 1) { echo "Users table created.<br />"; } else { echo "Error creating Users table."; }
|
if (dobatch($query) == 1) { echo "Users table created.<br />"; } else { echo "Error creating Users table."; }
|
||||||
unset($query);
|
unset($query);
|
||||||
|
@ -759,7 +759,7 @@ function fourth() { // Final page: insert new user row, congratulate the person
|
||||||
|
|
||||||
global $dbsettings;
|
global $dbsettings;
|
||||||
$users = $dbsettings["prefix"] . "_users";
|
$users = $dbsettings["prefix"] . "_users";
|
||||||
$query = mysql_query("INSERT INTO $users SET id='1',username='$username',password='$password',email='$email1',verify='1',charname='$charname',charclass='$charclass',regdate=NOW(),onlinetime=NOW(),authlevel='1'") or die(mysql_error());
|
$query = mysqli_query(opendb(), "INSERT INTO $users SET id='1',username='$username',password='$password',email='$email1',verify='1',charname='$charname',charclass='$charclass',regdate=NOW(),onlinetime=NOW(),authlevel='1'") or die(mysql_error());
|
||||||
|
|
||||||
$page = <<<END
|
$page = <<<END
|
||||||
<html>
|
<html>
|
||||||
|
@ -809,4 +809,4 @@ END;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
49
lib.php
49
lib.php
|
@ -5,15 +5,6 @@ $numqueries = 0;
|
||||||
$version = "1.1.11";
|
$version = "1.1.11";
|
||||||
$build = "";
|
$build = "";
|
||||||
|
|
||||||
// Handling for servers with magic_quotes turned on.
|
|
||||||
// Example from php.net.
|
|
||||||
if (get_magic_quotes_gpc()) {
|
|
||||||
|
|
||||||
$_POST = array_map('stripslashes_deep', $_POST);
|
|
||||||
$_GET = array_map('stripslashes_deep', $_GET);
|
|
||||||
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
|
||||||
|
|
||||||
}
|
|
||||||
$_POST = array_map('addslashes_deep', $_POST);
|
$_POST = array_map('addslashes_deep', $_POST);
|
||||||
$_POST = array_map('html_deep', $_POST);
|
$_POST = array_map('html_deep', $_POST);
|
||||||
$_GET = array_map('addslashes_deep', $_GET);
|
$_GET = array_map('addslashes_deep', $_GET);
|
||||||
|
@ -49,23 +40,37 @@ function html_deep($value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function opendb() { // Open database connection.
|
function opendb() { // Open database connection.
|
||||||
|
|
||||||
include('config.php');
|
include('config.php');
|
||||||
extract($dbsettings);
|
extract($dbsettings);
|
||||||
$link = mysql_connect($server, $user, $pass) or die(mysql_error());
|
|
||||||
mysql_select_db($name) or die(mysql_error());
|
|
||||||
return $link;
|
|
||||||
|
|
||||||
|
// Créer une connexion à la base de données
|
||||||
|
$link = mysqli_connect($server, $user, $pass, $name);
|
||||||
|
|
||||||
|
// Vérifier la connexion
|
||||||
|
if (!$link) {
|
||||||
|
die("Connection failed: " . mysqli_connect_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
||||||
|
|
||||||
include('config.php');
|
include('config.php');
|
||||||
global $numqueries;
|
global $numqueries;
|
||||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error());
|
|
||||||
|
// Remplacer {{table}} par le préfixe de la table
|
||||||
|
$query = str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query);
|
||||||
|
|
||||||
|
// Exécuter la requête
|
||||||
|
$sqlquery = mysqli_query(opendb(), $query);
|
||||||
|
|
||||||
|
// Vérifier les erreurs de requête
|
||||||
|
if (!$sqlquery) {
|
||||||
|
die("Query failed: " . mysqli_error(opendb()));
|
||||||
|
}
|
||||||
|
|
||||||
$numqueries++;
|
$numqueries++;
|
||||||
return $sqlquery;
|
return $sqlquery;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gettemplate($templatename) { // SQL query for the template.
|
function gettemplate($templatename) { // SQL query for the template.
|
||||||
|
@ -127,7 +132,7 @@ function admindisplay($content, $title) { // Finalize page and output to browser
|
||||||
global $numqueries, $userrow, $controlrow, $starttime, $version, $build;
|
global $numqueries, $userrow, $controlrow, $starttime, $version, $build;
|
||||||
if (!isset($controlrow)) {
|
if (!isset($controlrow)) {
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = gettemplate("admin");
|
$template = gettemplate("admin");
|
||||||
|
@ -158,7 +163,7 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
global $numqueries, $userrow, $controlrow, $version, $build;
|
global $numqueries, $userrow, $controlrow, $version, $build;
|
||||||
if (!isset($controlrow)) {
|
if (!isset($controlrow)) {
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
}
|
}
|
||||||
if ($badstart == false) { global $starttime; } else { $starttime = $badstart; }
|
if ($badstart == false) { global $starttime; } else { $starttime = $badstart; }
|
||||||
|
|
||||||
|
@ -182,12 +187,12 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
// Get userrow again, in case something has been updated.
|
// Get userrow again, in case something has been updated.
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$userquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
unset($userrow);
|
unset($userrow);
|
||||||
$userrow = mysql_fetch_array($userquery);
|
$userrow = mysqli_fetch_array($userquery);
|
||||||
|
|
||||||
// Current town name.
|
// Current town name.
|
||||||
if ($userrow["currentaction"] == "In Town") {
|
if ($userrow["currentaction"] == "In Town") {
|
||||||
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
|
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
|
||||||
} else {
|
} else {
|
||||||
$userrow["currenttown"] = "";
|
$userrow["currenttown"] = "";
|
||||||
|
@ -234,7 +239,7 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
$spellquery = doquery("SELECT id,name,type FROM {{table}}","spells");
|
$spellquery = doquery("SELECT id,name,type FROM {{table}}","spells");
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$userrow["magiclist"] = "";
|
$userrow["magiclist"] = "";
|
||||||
while ($spellrow = mysql_fetch_array($spellquery)) {
|
while ($spellrow = mysqli_fetch_array($spellquery)) {
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach($userspells as $a => $b) {
|
foreach($userspells as $a => $b) {
|
||||||
if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; }
|
if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; }
|
||||||
|
@ -249,7 +254,7 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
$townslist = explode(",",$userrow["towns"]);
|
$townslist = explode(",",$userrow["towns"]);
|
||||||
$townquery2 = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
$townquery2 = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
||||||
$userrow["townslist"] = "";
|
$userrow["townslist"] = "";
|
||||||
while ($townrow2 = mysql_fetch_array($townquery2)) {
|
while ($townrow2 = mysqli_fetch_array($townquery2)) {
|
||||||
$town = false;
|
$town = false;
|
||||||
foreach($townslist as $a => $b) {
|
foreach($townslist as $a => $b) {
|
||||||
if ($b == $townrow2["id"]) { $town = true; }
|
if ($b == $townrow2["id"]) { $town = true; }
|
||||||
|
|
|
@ -14,8 +14,8 @@ function login() {
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE username='".$_POST["username"]."' AND password='".md5($_POST["password"])."' LIMIT 1", "users");
|
$query = doquery("SELECT * FROM {{table}} WHERE username='".$_POST["username"]."' AND password='".md5($_POST["password"])."' LIMIT 1", "users");
|
||||||
if (mysql_num_rows($query) != 1) { die("Invalid username or password. Please go back and try again."); }
|
if (mysqli_num_rows($query) != 1) { die("Invalid username or password. Please go back and try again."); }
|
||||||
$row = mysql_fetch_array($query);
|
$row = mysqli_fetch_array($query);
|
||||||
if (isset($_POST["rememberme"])) { $expiretime = time()+31536000; $rememberme = 1; } else { $expiretime = 0; $rememberme = 0; }
|
if (isset($_POST["rememberme"])) { $expiretime = time()+31536000; $rememberme = 1; } else { $expiretime = 0; $rememberme = 0; }
|
||||||
$cookie = $row["id"] . " " . $row["username"] . " " . md5($row["password"] . "--" . $dbsettings["secretword"]) . " " . $rememberme;
|
$cookie = $row["id"] . " " . $row["username"] . " " . md5($row["password"] . "--" . $dbsettings["secretword"]) . " " . $rememberme;
|
||||||
setcookie("dkgame", $cookie, $expiretime, "/", "", 0);
|
setcookie("dkgame", $cookie, $expiretime, "/", "", 0);
|
||||||
|
|
42
towns.php
42
towns.php
|
@ -5,8 +5,8 @@ function inn() { // Staying at the inn resets all expendable stats to their max
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,innprice FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,innprice FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysqli_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["innprice"]) { display("You do not have enough gold to stay at this Inn tonight.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.", "Inn"); die(); }
|
if ($userrow["gold"] < $townrow["innprice"]) { display("You do not have enough gold to stay at this Inn tonight.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.", "Inn"); die(); }
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ function buy() { // Displays a list of available items for purchase.
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysqli_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
|
|
||||||
$itemslist = explode(",",$townrow["itemslist"]);
|
$itemslist = explode(",",$townrow["itemslist"]);
|
||||||
$querystring = "";
|
$querystring = "";
|
||||||
|
@ -54,7 +54,7 @@ function buy() { // Displays a list of available items for purchase.
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE $querystring ORDER BY id", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} WHERE $querystring ORDER BY id", "items");
|
||||||
$page = "Buying weapons will increase your Attack Power. Buying armor and shields will increase your Defense Power.<br /><br />Click an item name to purchase it.<br /><br />The following items are available at this town:<br /><br />\n";
|
$page = "Buying weapons will increase your Attack Power. Buying armor and shields will increase your Defense Power.<br /><br />Click an item name to purchase it.<br /><br />The following items are available at this town:<br /><br />\n";
|
||||||
$page .= "<table width=\"80%\">\n";
|
$page .= "<table width=\"80%\">\n";
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = mysqli_fetch_array($itemsquery)) {
|
||||||
if ($itemsrow["type"] == 1) { $attrib = "Attack Power:"; } else { $attrib = "Defense Power:"; }
|
if ($itemsrow["type"] == 1) { $attrib = "Attack Power:"; } else { $attrib = "Defense Power:"; }
|
||||||
$page .= "<tr><td width=\"4%\">";
|
$page .= "<tr><td width=\"4%\">";
|
||||||
if ($itemsrow["type"] == 1) { $page .= "<img src=\"images/icon_weapon.gif\" alt=\"weapon\" /></td>"; }
|
if ($itemsrow["type"] == 1) { $page .= "<img src=\"images/icon_weapon.gif\" alt=\"weapon\" /></td>"; }
|
||||||
|
@ -80,20 +80,20 @@ function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysqli_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
$townitems = explode(",",$townrow["itemslist"]);
|
$townitems = explode(",",$townrow["itemslist"]);
|
||||||
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
||||||
$itemsrow = mysql_fetch_array($itemsquery);
|
$itemsrow = mysqli_fetch_array($itemsquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
||||||
|
|
||||||
if ($itemsrow["type"] == 1) {
|
if ($itemsrow["type"] == 1) {
|
||||||
if ($userrow["weaponid"] != 0) {
|
if ($userrow["weaponid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysqli_fetch_array($itemsquery2);
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
} else {
|
} else {
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
@ -101,7 +101,7 @@ function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
} elseif ($itemsrow["type"] == 2) {
|
} elseif ($itemsrow["type"] == 2) {
|
||||||
if ($userrow["armorid"] != 0) {
|
if ($userrow["armorid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysqli_fetch_array($itemsquery2);
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
} else {
|
} else {
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
@ -109,7 +109,7 @@ function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
} elseif ($itemsrow["type"] == 3) {
|
} elseif ($itemsrow["type"] == 3) {
|
||||||
if ($userrow["shieldid"] != 0) {
|
if ($userrow["shieldid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysqli_fetch_array($itemsquery2);
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
} else {
|
} else {
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
@ -128,13 +128,13 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysqli_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
$townitems = explode(",",$townrow["itemslist"]);
|
$townitems = explode(",",$townrow["itemslist"]);
|
||||||
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
||||||
$itemsrow = mysql_fetch_array($itemsquery);
|
$itemsrow = mysqli_fetch_array($itemsquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
// Check if they already have an item in the slot.
|
// Check if they already have an item in the slot.
|
||||||
if ($userrow["weaponid"] != 0) {
|
if ($userrow["weaponid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysqli_fetch_array($itemsquery2);
|
||||||
} else {
|
} else {
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
// Check if they already have an item in the slot.
|
// Check if they already have an item in the slot.
|
||||||
if ($userrow["armorid"] != 0) {
|
if ($userrow["armorid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysqli_fetch_array($itemsquery2);
|
||||||
} else {
|
} else {
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
// Check if they already have an item in the slot.
|
// Check if they already have an item in the slot.
|
||||||
if ($userrow["shieldid"] != 0) {
|
if ($userrow["shieldid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysqli_fetch_array($itemsquery2);
|
||||||
} else {
|
} else {
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ function maps() { // List maps the user can buy.
|
||||||
$page .= "<table width=\"90%\">\n";
|
$page .= "<table width=\"90%\">\n";
|
||||||
|
|
||||||
$townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
$townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
||||||
while ($townrow = mysql_fetch_array($townquery)) {
|
while ($townrow = mysqli_fetch_array($townquery)) {
|
||||||
|
|
||||||
if ($townrow["latitude"] >= 0) { $latitude = $townrow["latitude"] . "N,"; } else { $latitude = ($townrow["latitude"]*-1) . "S,"; }
|
if ($townrow["latitude"] >= 0) { $latitude = $townrow["latitude"] . "N,"; } else { $latitude = ($townrow["latitude"]*-1) . "S,"; }
|
||||||
if ($townrow["longitude"] >= 0) { $longitude = $townrow["longitude"] . "E"; } else { $longitude = ($townrow["longitude"]*-1) . "W"; }
|
if ($townrow["longitude"] >= 0) { $longitude = $townrow["longitude"] . "E"; } else { $longitude = ($townrow["longitude"]*-1) . "W"; }
|
||||||
|
@ -313,7 +313,7 @@ function maps2($id) { // Confirm user's intent to purchase map.
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ function maps3($id) { // Add new map to user's profile.
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ function travelto($id, $usepoints=true) { // Send a user to a town from the Trav
|
||||||
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,travelpoints,latitude,longitude FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,travelpoints,latitude,longitude FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysqli_fetch_array($townquery);
|
||||||
|
|
||||||
if ($usepoints==true) {
|
if ($usepoints==true) {
|
||||||
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
|
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ unset($query);
|
||||||
|
|
||||||
$query = mysql_query("SELECT * FROM $users ORDER BY id") or die(mysql_error());
|
$query = mysql_query("SELECT * FROM $users ORDER BY id") or die(mysql_error());
|
||||||
$errors = 0; $errorlist = "";
|
$errors = 0; $errorlist = "";
|
||||||
while ($row = mysql_fetch_array($query)) {
|
while ($row = mysqli_fetch_array($query)) {
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
$oldspells = explode(",",$row["spells"]);
|
$oldspells = explode(",",$row["spells"]);
|
||||||
$newspells = "0,";
|
$newspells = "0,";
|
||||||
|
|
|
@ -331,7 +331,7 @@ $levels["3"] = array(
|
||||||
$errors = 0; $errorlist = "";
|
$errors = 0; $errorlist = "";
|
||||||
|
|
||||||
$mainquery = mysql_query("SELECT id,level,charclass,spells FROM $users ORDER BY id");
|
$mainquery = mysql_query("SELECT id,level,charclass,spells FROM $users ORDER BY id");
|
||||||
while ($mainrow = mysql_fetch_array($mainquery)) {
|
while ($mainrow = mysqli_fetch_array($mainquery)) {
|
||||||
$level = $mainrow["level"];
|
$level = $mainrow["level"];
|
||||||
$charclass = $mainrow["charclass"];
|
$charclass = $mainrow["charclass"];
|
||||||
$newspell = $levels[$charclass][$level];
|
$newspell = $levels[$charclass][$level];
|
||||||
|
|
24
users.php
24
users.php
|
@ -16,7 +16,7 @@ if (isset($_GET["do"])) {
|
||||||
function register() { // Register a new account.
|
function register() { // Register a new account.
|
||||||
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
|
||||||
|
@ -28,20 +28,20 @@ function register() { // Register a new account.
|
||||||
if ($username == "") { $errors++; $errorlist .= "Username field is required.<br />"; }
|
if ($username == "") { $errors++; $errorlist .= "Username field is required.<br />"; }
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
||||||
$usernamequery = doquery("SELECT username FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
$usernamequery = doquery("SELECT username FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
||||||
if (mysql_num_rows($usernamequery) > 0) { $errors++; $errorlist .= "Username already taken - unique username required.<br />"; }
|
if (mysqli_num_rows($usernamequery) > 0) { $errors++; $errorlist .= "Username already taken - unique username required.<br />"; }
|
||||||
|
|
||||||
// Process charname.
|
// Process charname.
|
||||||
if ($charname == "") { $errors++; $errorlist .= "Character Name field is required.<br />"; }
|
if ($charname == "") { $errors++; $errorlist .= "Character Name field is required.<br />"; }
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $charname)==1) { $errors++; $errorlist .= "Character Name must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
if (preg_match("/[^A-z0-9_\-]/", $charname)==1) { $errors++; $errorlist .= "Character Name must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
||||||
$characternamequery = doquery("SELECT charname FROM {{table}} WHERE charname='$charname' LIMIT 1","users");
|
$characternamequery = doquery("SELECT charname FROM {{table}} WHERE charname='$charname' LIMIT 1","users");
|
||||||
if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; }
|
if (mysqli_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; }
|
||||||
|
|
||||||
// Process email address.
|
// Process email address.
|
||||||
if ($email1 == "" || $email2 == "") { $errors++; $errorlist .= "Email fields are required.<br />"; }
|
if ($email1 == "" || $email2 == "") { $errors++; $errorlist .= "Email fields are required.<br />"; }
|
||||||
if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.<br />"; }
|
if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.<br />"; }
|
||||||
if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.<br />"; }
|
if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.<br />"; }
|
||||||
$emailquery = doquery("SELECT email FROM {{table}} WHERE email='$email1' LIMIT 1","users");
|
$emailquery = doquery("SELECT email FROM {{table}} WHERE email='$email1' LIMIT 1","users");
|
||||||
if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.<br />"; }
|
if (mysqli_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.<br />"; }
|
||||||
|
|
||||||
// Process password.
|
// Process password.
|
||||||
if (trim($password1) == "") { $errors++; $errorlist .= "Password field is required.<br />"; }
|
if (trim($password1) == "") { $errors++; $errorlist .= "Password field is required.<br />"; }
|
||||||
|
@ -100,8 +100,8 @@ function verify() {
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
extract($_POST);
|
||||||
$userquery = doquery("SELECT username,email,verify FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
$userquery = doquery("SELECT username,email,verify FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
||||||
if (mysql_num_rows($userquery) != 1) { die("No account with that username."); }
|
if (mysqli_num_rows($userquery) != 1) { die("No account with that username."); }
|
||||||
$userrow = mysql_fetch_array($userquery);
|
$userrow = mysqli_fetch_array($userquery);
|
||||||
if ($userrow["verify"] == 1) { die("Your account is already verified."); }
|
if ($userrow["verify"] == 1) { die("Your account is already verified."); }
|
||||||
if ($userrow["email"] != $email) { die("Incorrect email address."); }
|
if ($userrow["email"] != $email) { die("Incorrect email address."); }
|
||||||
if ($userrow["verify"] != $verify) { die("Incorrect verification code."); }
|
if ($userrow["verify"] != $verify) { die("Incorrect verification code."); }
|
||||||
|
@ -120,7 +120,7 @@ function lostpassword() {
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
extract($_POST);
|
||||||
$userquery = doquery("SELECT email FROM {{table}} WHERE email='$email' LIMIT 1","users");
|
$userquery = doquery("SELECT email FROM {{table}} WHERE email='$email' LIMIT 1","users");
|
||||||
if (mysql_num_rows($userquery) != 1) { die("No account with that email address."); }
|
if (mysqli_num_rows($userquery) != 1) { die("No account with that email address."); }
|
||||||
$newpass = "";
|
$newpass = "";
|
||||||
for ($i=0; $i<8; $i++) {
|
for ($i=0; $i<8; $i++) {
|
||||||
$newpass .= chr(rand(65,90));
|
$newpass .= chr(rand(65,90));
|
||||||
|
@ -145,8 +145,8 @@ function changepassword() {
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
extract($_POST);
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
$userquery = doquery("SELECT * FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
||||||
if (mysql_num_rows($userquery) != 1) { die("No account with that username."); }
|
if (mysqli_num_rows($userquery) != 1) { die("No account with that username."); }
|
||||||
$userrow = mysql_fetch_array($userquery);
|
$userrow = mysqli_fetch_array($userquery);
|
||||||
if ($userrow["password"] != md5($oldpass)) { die("The old password you provided was incorrect."); }
|
if ($userrow["password"] != md5($oldpass)) { die("The old password you provided was incorrect."); }
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $newpass1)==1) { die("New password must be alphanumeric."); } // Thanks to "Carlos Pires" from php.net!
|
if (preg_match("/[^A-z0-9_\-]/", $newpass1)==1) { die("New password must be alphanumeric."); } // Thanks to "Carlos Pires" from php.net!
|
||||||
if ($newpass1 != $newpass2) { die("New passwords don't match."); }
|
if ($newpass1 != $newpass2) { die("New passwords don't match."); }
|
||||||
|
@ -165,7 +165,7 @@ function changepassword() {
|
||||||
function sendpassemail($emailaddress, $password) {
|
function sendpassemail($emailaddress, $password) {
|
||||||
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
extract($controlrow);
|
extract($controlrow);
|
||||||
|
|
||||||
$email = <<<END
|
$email = <<<END
|
||||||
|
@ -186,7 +186,7 @@ END;
|
||||||
function sendregmail($emailaddress, $vercode) {
|
function sendregmail($emailaddress, $vercode) {
|
||||||
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
extract($controlrow);
|
extract($controlrow);
|
||||||
$verurl = $gameurl . "?do=verify";
|
$verurl = $gameurl . "?do=verify";
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ END;
|
||||||
function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
|
function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
|
||||||
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = mysqli_fetch_array($controlquery);
|
||||||
extract($controlrow);
|
extract($controlrow);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue