bug fixes

This commit is contained in:
Sky Johnson 2024-08-08 13:13:06 -05:00
parent 6f782914ca
commit edb4504a5c
4 changed files with 77 additions and 70 deletions

View File

@ -37,10 +37,10 @@ $userrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$acctrow["activech
if ($userrow != false) { $userrow = array_map("stripslashes", $userrow); } if ($userrow != false) { $userrow = array_map("stripslashes", $userrow); }
// World row. // World row.
$worldrow = dorow(doquery("SELECT * FROM <<worlds>> WHERE id='".$userrow["world"]."' LIMIT 1")); $worldrow = dorow(doquery("SELECT * FROM <<worlds>> WHERE id='".($userrow["world"] ?? 1)."' LIMIT 1"));
// Town row. // Town row.
if ($userrow["currentaction"] == "In Town") { if (isset($userrow["currentaction"]) && $userrow["currentaction"] == "In Town") {
$townrow = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' AND longitude='".$userrow["longitude"]."' AND latitude='".$userrow["latitude"]."' LIMIT 1")); $townrow = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' AND longitude='".$userrow["longitude"]."' AND latitude='".$userrow["latitude"]."' LIMIT 1"));
} else { } else {
$townrow = false; $townrow = false;

View File

@ -216,7 +216,7 @@ function display($title, $content, $panels = true) { // Finalize page and output
$row = array(); $row = array();
$row["gamename"] = $controlrow["gamename"]; $row["gamename"] = $controlrow["gamename"];
$row["pagetitle"] = $title; $row["pagetitle"] = $title;
$row["background"] = "background" . $userrow["world"]; $row["background"] = (isset($userrow['world'])) ? "background" . $userrow["world"] : "background";
$row["version"] = $version; $row["version"] = $version;
$row["content"] = $content; $row["content"] = $content;
$row["moddedby"] = $controlrow["moddedby"]; $row["moddedby"] = $controlrow["moddedby"];

View File

@ -126,7 +126,11 @@ function paneltop($loggedin = true) {
global $acctrow, $userrow; global $acctrow, $userrow;
if ($loggedin == true || isset($acctrow)) { if ($loggedin == true || isset($acctrow)) {
if ($userrow == false) { $userrow["charname"] = "No Characters Yet"; $userrow["guild"] = 0; } if (empty($userrow) || !isset($userrow) || $userrow === false) {
$userrow = [];
$userrow["charname"] = "No Characters Yet";
$userrow["guild"] = 0;
}
//if ($acctrow["authlevel"] == 255) { $admin = " (<a href=\"admin/index.php\">Admin</a>)"; } else { $admin = ""; } //if ($acctrow["authlevel"] == 255) { $admin = " (<a href=\"admin/index.php\">Admin</a>)"; } else { $admin = ""; }
$admin = ""; $admin = "";
if ($userrow["guild"] != 0) { if ($userrow["guild"] != 0) {

View File

@ -358,6 +358,7 @@ function charnew() {
$characternamequery = doquery("SELECT charname FROM <<users>> WHERE charname='$charname' LIMIT 1"); $characternamequery = doquery("SELECT charname FROM <<users>> WHERE charname='$charname' LIMIT 1");
if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; } if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; }
// Upload new charpicture, if required. // Upload new charpicture, if required.
if ($_FILES["intavatar"]["error"] != 4) { if ($_FILES["intavatar"]["error"] != 4) {
@ -377,7 +378,9 @@ function charnew() {
if (!move_uploaded_file($_FILES["intavatar"]["tmp_name"], $uploadfile)) { die("Unable to upload avatar."); } if (!move_uploaded_file($_FILES["intavatar"]["tmp_name"], $uploadfile)) { die("Unable to upload avatar."); }
$newcharpicture = $controlrow["avatarurl"] . $acctrow["username"] . $randomext . $type; $newcharpicture = $controlrow["avatarurl"] . $acctrow["username"] . $randomext . $type;
} } else {
$newcharpicture = $controlrow["avatarurl"] . "nopicture.gif";
}
// Process everything else important. // Process everything else important.
if (!is_numeric($charclass)) { $errors++; $errorlist .= "Invalid character class.<br />"; } if (!is_numeric($charclass)) { $errors++; $errorlist .= "Invalid character class.<br />"; }