primary(),
'items' => items(),
'edititem' => edititem($do[1]),
'drops' => drops(),
'editdrop' => editdrop($do[1]),
'towns' => towns(),
'edittown' => edittown($do[1]),
'monsters' => monsters(),
'editmonster' => editmonster($do[1]),
'levels' => levels(),
'editlevel' => editlevel(),
'spells' => spells(),
'editspell' => editspell($do[1]),
'users' => users(),
'edituser' => edituser($do[1]),
'news' => addnews(),
default => donothing()
};
function donothing()
{
$page = <<
Please note that the control panel has been created mostly as a shortcut for certain individual settings. It is
meant for use primarily with editing one thing at a time. If you need to completely replace an entire table
(say, to replace all stock monsters with your own new ones), it is suggested that you use a more in-depth
database tool such as phpMyAdmin. Also, you may want
to have a copy of the Dragon Knight development kit, available from the
Dragon Knight homepage.
Also, you should be aware that certain portions of the DK code are dependent on the formatting of certain
database results (for example, the special attributes on item drops). While I have attempted to point these out
throughout the admin script, you should definitely pay attention and be careful when editing some fields,
because mistakes in the database content may result in script errors or your game breaking completely.
HTML;
admindisplay($page, "Admin Home");
}
function primary()
{
if (isset($_POST["submit"])) {
$form = validate($_POST, [
'gamename' => ['alphanum-spaces', 'length:1-20'],
'gamesize' => ['int', 'min:5'],
'class1name' => ['alpha-spaces', 'length:1-18'],
'class2name' => ['alpha-spaces', 'length:1-18'],
'class3name' => ['alpha-spaces', 'length:1-18'],
'gameopen' => ['bool'],
'verifyemail' => ['bool'],
'shownews' => ['bool'],
'showonline' => ['bool'],
'showbabble' => ['bool']
]);
if ($form['valid']) {
$form = $form['data'];
if (($form['gamesize'] % 5) != 0) exit('Map size must be divisible by five.');
db()->query('UPDATE control SET gamename=?, gamesize=?, class1name=?, class2name=?, class3name=?, gameopen=?, verifyemail=?, gameurl=?, adminemail=?, shownews=?, showonline=?, showbabble=? WHERE id=1;', [
$form['gamename'], $form['gamesize'], $form['class1name'], $form['class1name'], $form['class1name'], $form['gameopen'], $form['verifyemail'], $form['gameurl'], $form['adminemail'], $form['shownews'], $form['showonline'], $form['showbabble']
]);
admindisplay("Settings updated.", "Main Settings");
} else {
$errorlist = ul_from_validate_errors($form['errors']);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Main Settings");
}
}
global $controlrow;
$page = <<Main Settings
These options control several major settings for the overall game engine.
HTML;
if ($controlrow["verifyemail"] == 0) { $controlrow["selectverify0"] = "selected=\"selected\" "; } else { $controlrow["selectverify0"] = ""; }
if ($controlrow["verifyemail"] == 1) { $controlrow["selectverify1"] = "selected=\"selected\" "; } else { $controlrow["selectverify1"] = ""; }
if ($controlrow["shownews"] == 0) { $controlrow["selectnews0"] = "selected=\"selected\" "; } else { $controlrow["selectnews0"] = ""; }
if ($controlrow["shownews"] == 1) { $controlrow["selectnews1"] = "selected=\"selected\" "; } else { $controlrow["selectnews1"] = ""; }
if ($controlrow["showonline"] == 0) { $controlrow["selectonline0"] = "selected=\"selected\" "; } else { $controlrow["selectonline0"] = ""; }
if ($controlrow["showonline"] == 1) { $controlrow["selectonline1"] = "selected=\"selected\" "; } else { $controlrow["selectonline1"] = ""; }
if ($controlrow["showbabble"] == 0) { $controlrow["selectbabble0"] = "selected=\"selected\" "; } else { $controlrow["selectbabble0"] = ""; }
if ($controlrow["showbabble"] == 1) { $controlrow["selectbabble1"] = "selected=\"selected\" "; } else { $controlrow["selectbabble1"] = ""; }
if ($controlrow["gameopen"] == 1) { $controlrow["open1select"] = "selected=\"selected\" "; } else { $controlrow["open1select"] = ""; }
if ($controlrow["gameopen"] == 0) { $controlrow["open0select"] = "selected=\"selected\" "; } else { $controlrow["open0select"] = ""; }
admindisplay(parsetemplate($page, $controlrow), "Main Settings");
}
function items()
{
$items = db()->query('SELECT id, name FROM items ORDER BY id;');
$page = "Edit Items Click an item's name to edit it.
", "Edit Items");
}
function edititem($id)
{
if (isset($_POST["submit"])) {
$errors = [];
$n = trim($_POST['name'] ?? '');
$bc = (int) trim($_POST['buycost'] ?? 0);
$a = (int) trim($_POST['attribute'] ?? 0);
$s = trim($_POST['special'] ?? 'X');
if (empty($n)) $errors[] = "Name is required.";
if (!is_int($bc) || !($bc >= 0)) $errors[] = 'Cost must be a number greater than or equal to 0.';
if (!is_int($a)) $errors[] = 'Attribute must be a number.';
if (count($errors) === 0) {
db()->query('UPDATE items SET name=?, type=?, buycost=?, attribute=?, special=? WHERE id=?;', [
$n, $_POST['type'] ?? 0, $bc, $a, $s, $id
]);
admindisplay("Item updated.","Edit Items");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit Items");
}
}
$item = get_item($id);
$page = <<Edit Items
Special Codes:
Special codes can be added in the item's Special field to give it extra user attributes. Special codes are in the format attribute,value. Attribute can be any database field from the Users table - however, it is suggested that you only use the ones from the list below, otherwise things can get freaky. Value may be any positive or negative whole number. For example, if you want a weapon to give an additional 50 max hit points, the special code would be maxhp,50.
Suggested user fields for special codes:
maxhp - max hit points
maxmp - max magic points
maxtp - max travel points
goldbonus - gold bonus, in percent
expbonus - experience bonus, in percent
strength - strength (which also adds to attackpower)
dexterity - dexterity (which also adds to defensepower)
attackpower - total attack power
defensepower - total defense power
HTML;
if ($item["type"] == 1) { $item["type1select"] = "selected=\"selected\" "; } else { $item["type1select"] = ""; }
if ($item["type"] == 2) { $item["type2select"] = "selected=\"selected\" "; } else { $item["type2select"] = ""; }
if ($item["type"] == 3) { $item["type3select"] = "selected=\"selected\" "; } else { $item["type3select"] = ""; }
admindisplay(parsetemplate($page, $item), "Edit Items");
}
function drops()
{
$page = "Edit Drops Click an item's name to edit it.
\n";
$drops = db()->query('SELECT id, name FROM drops ORDER BY id;');
$has_drops = false;
while ($row = $drops->fetchArray(SQLITE3_ASSOC)) {
$has_drops = true;
$page .= "
", "Edit Drops");
}
function editdrop($id)
{
if (isset($_POST["submit"])) {
$errors = [];
$n = trim($_POST['name'] ?? '');
$ml = (int) trim($_POST['mlevel'] ?? 0);
$a = trim($_POST['attribute1'] ?? 'X');
$a2 = trim($_POST['attribute2'] ?? 'X');
if (empty($n)) $errors[] = "Name is required.";
if (!is_int($ml) || $ml < 1) $errors[] = "Monster level is required, and must be higher than 0.";
if (empty($a) || $a === 'X') $errors[] = 'First attribute is required.';
if (empty($a2)) $a2 = 'X';
if (count($errors) === 0) {
db()->query('UPDATE drops SET name=?, mlevel=?, attribute1=?, attribute2=? WHERE id=?;', [
$n, $ml, $a, $a2, $id
]);
admindisplay("Item updated.","Edit Drops");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit Drops");
}
}
$drop = get_drop($id);
$page = <<Edit Drops
Special Codes:
Special codes are used in the two attribute fields to give the item properties. The first attribute field must contain a special code, but the second one may be left empty ("X") if you wish. Special codes are in the format attribute,value. Attribute can be any database field from the Users table - however, it is suggested that you only use the ones from the list below, otherwise things can get freaky. Value may be any positive or negative whole number. For example, if you want a weapon to give an additional 50 max hit points, the special code would be maxhp,50.
Suggested user fields for special codes:
maxhp - max hit points
maxmp - max magic points
maxtp - max travel points
goldbonus - gold bonus, in percent
expbonus - experience bonus, in percent
strength - strength (which also adds to attackpower)
dexterity - dexterity (which also adds to defensepower)
attackpower - total attack power
defensepower - total defense power
HTML;
admindisplay(parsetemplate($page, $drop), "Edit Drops");
}
function towns()
{
$page = "Edit Towns Click an town's name to edit it.
\n";
$towns = db()->query('SELECT id, name FROM towns ORDER BY id;');
$has_towns = false;
while ($row = $towns->fetchArray(SQLITE3_ASSOC)) {
$has_towns = true;
$page .= "
", "Edit Towns");
}
function edittown($id)
{
global $controlrow;
if (isset($_POST["submit"])) {
$n = trim($_POST['name'] ?? '');
$la = (int) trim($_POST['latitude'] ?? 0);
$lo = (int) trim($_POST['longitude'] ?? 0);
$ip = (int) trim($_POST['innprice'] ?? 0);
$mp = (int) trim($_POST['mapprice'] ?? 0);
$tp = (int) trim($_POST['travelpoints'] ?? 0);
$il = trim($_POST['itemslist'] ?? '');
$errors = [];
if (empty($n)) $errors[] = 'Name is required.';
if ($la > $controlrow['gamesize'] || $la < ($controlrow['gamesize'] * -1))
$errors[] = "Latitude must be a number and within the bounds of the game size. ({$controlrow['gamesize']}";
if ($lo > $controlrow['gamesize'] || $la < ($controlrow['gamesize'] * -1))
$errors[] = "Longitude must be a number and within the bounds of the game size. ({$controlrow['gamesize']}";
if ($ip < 0) $errors[] = "Inn price must be a number greater than or equal to 0.";
if ($mp < 0) $errors[] = "Map price must be a number greater than or equal to 0.";
if ($tp < 0) $errors[] = "Travel points must be a number greater than or equal to 0.";
if ($errors == 0) {
db()->query('UPDATE towns SET name=?, latitude=?, longitude=?, innprice=?, mapprice=?, travelpoints=?, itemslist=? WHERE id=?;', [
$n, $la, $lo, $ip, $mp, $tp, $il, $id
]);
admindisplay("Town updated.", "Edit Towns");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit Towns");
}
}
$row = get_town_by_id($id);
$page = <<Edit Towns
HTML;
admindisplay(parsetemplate($page, $row), "Edit Towns");
}
function monsters()
{
global $controlrow;
$max_level = db()->query('SELECT level FROM monsters ORDER BY level DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC)['level'];
$monsters = db()->query('SELECT id, name FROM monsters ORDER BY id;');
$page = "Edit Monsters ";
if (($controlrow['gamesize'] / 5) !== $max_level) {
$page .= "Note: Your highest monster level does not match with your entered map size. Highest monster level should be ".($controlrow["gamesize"] / 5).", yours is $max_level. Please fix this before opening the game to the public. ";
} else {
$page .= "Monster level and map size match. No further actions are required for map compatibility. ";
}
$page .= "Click an monster's name to edit it.
", "Edit Monster");
}
function editmonster($id)
{
if (isset($_POST["submit"])) {
$n = trim($_POST['name'] ?? '');
$mh = (int) trim($_POST['maxhp'] ?? 0);
$md = (int) trim($_POST['maxdam'] ?? 0);
$a = (int) trim($_POST['armor'] ?? 0);
$l = (int) trim($_POST['level'] ?? 0);
$me = (int) trim($_POST['maxexp'] ?? 0);
$mg = (int) trim($_POST['maxgold'] ?? 0);
$errors = [];
if (empty($n)) $errors[] = "Name is required.";
if ($mh < 1) $errors[] = "Max HP must be a number greater than or equal to 1.";
if ($md < 0) $errors[] = "Max Damage must be a number greater than or equal to 0.";
if ($a < 0) $errors[] = "Armor must be a number greater than or equal to 0.";
if ($l < 1) $errors[] = "Level must be a number greater than or equal to 1.";
if ($me < 0) $errors[] = "Max Exp must be a number greater than or equal to 0.";
if ($mg < 0) $errors[] = "Max Gold must be a number greater than or equal to 0.";
if (count($errors) === 0) {
db()->query('UPDATE monsters SET name=?, maxhp=?, maxdam=?, armor=?, level=?, maxexp=?, maxgold=?, immune=? WHERE id=?;', [
$n, $mh, $md, $a, $l, $me, $mg, $_POST['immune'] ?? 0, $id
]);
admindisplay("Monster updated.", "Edit monsters");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit monsters");
}
}
$row = get_monster($id);
$page = <<Edit Monsters
HTML;
if ($row["immune"] == 1) { $row["immune1select"] = "selected=\"selected\" "; } else { $row["immune1select"] = ""; }
if ($row["immune"] == 2) { $row["immune2select"] = "selected=\"selected\" "; } else { $row["immune2select"] = ""; }
if ($row["immune"] == 3) { $row["immune3select"] = "selected=\"selected\" "; } else { $row["immune3select"] = ""; }
admindisplay(parsetemplate($page, $row), "Edit Monsters");
}
function spells()
{
$page = "Edit Spells Click an spell's name to edit it.
\n";
$spells = db()->query('SELECT id, name FROM spells ORDER BY id;');
$has_spells = false;
while ($row = $spells->fetchArray(SQLITE3_ASSOC)) {
$has_spells = true;
$page .= "
", "Edit Spells");
}
function editspell($id)
{
if (isset($_POST["submit"])) {
$n = trim($_POST['name'] ?? '');
$mp = (int) trim($_POST['mp'] ?? 0);
$a = (int) trim($_POST['attribute'] ?? 0);
$errors = [];
if (empty($n)) $errors[] = "Name is required.";
if ($mp < 0) $errors[] = "MP must be a number greater than or equal to 0.";
if ($a < 0) $errors[] = "Attribute must be a number greater than or equal to 0.";
if (count($errors) === 0) {
db()->query('UPDATE spells SET name=?, mp=?, attribute=?, type=? WHERE id=?;', [
$n, $mp, $a, $_POST['type'] ?? 0, $id
]);
admindisplay("Spell updated.", "Edit Spells");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit Spells");
}
}
$row = get_spell($id);
$page = <<Edit Spells
HTML;
if ($row["type"] == 1) { $row["type1select"] = "selected=\"selected\" "; } else { $row["type1select"] = ""; }
if ($row["type"] == 2) { $row["type2select"] = "selected=\"selected\" "; } else { $row["type2select"] = ""; }
if ($row["type"] == 3) { $row["type3select"] = "selected=\"selected\" "; } else { $row["type3select"] = ""; }
if ($row["type"] == 4) { $row["type4select"] = "selected=\"selected\" "; } else { $row["type4select"] = ""; }
if ($row["type"] == 5) { $row["type5select"] = "selected=\"selected\" "; } else { $row["type5select"] = ""; }
admindisplay(parsetemplate($page, $row), "Edit Spells");
}
function levels()
{
$max_level = db()->query('SELECT id FROM levels ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC)['id'];
$options = "";
for ($i = 2; $i < $max_level; $i++) {
$options .= "\n";
}
$page = <<Edit Levels
Select a level number from the dropdown box to edit it.
HTML;
admindisplay($page, "Edit Levels");
}
function editlevel()
{
if (!isset($_POST["level"])) admindisplay("No level to edit.", "Edit Levels");
$id = $_POST["level"];
if (isset($_POST["submit"])) {
unset($_POST['submit']);
$errors = [];
if ($_POST["one_exp"] == "") $errors[] = "Class 1 Experience is required.";
if ($_POST["one_hp"] == "") $errors[] = "Class 1 HP is required.";
if ($_POST["one_mp"] == "") $errors[] = "Class 1 MP is required.";
if ($_POST["one_tp"] == "") $errors[] = "Class 1 TP is required.";
if ($_POST["one_strength"] == "") $errors[] = "Class 1 Strength is required.";
if ($_POST["one_dexterity"] == "") $errors[] = "Class 1 Dexterity is required.";
if ($_POST["one_spells"] == "") $errors[] = "Class 1 Spells is required.";
if (!is_numeric($_POST["one_exp"])) $errors[] = "Class 1 Experience must be a number.";
if (!is_numeric($_POST["one_hp"])) $errors[] = "Class 1 HP must be a number.";
if (!is_numeric($_POST["one_mp"])) $errors[] = "Class 1 MP must be a number.";
if (!is_numeric($_POST["one_tp"])) $errors[] = "Class 1 TP must be a number.";
if (!is_numeric($_POST["one_strength"])) $errors[] = "Class 1 Strength must be a number.";
if (!is_numeric($_POST["one_dexterity"])) $errors[] = "Class 1 Dexterity must be a number.";
if (!is_numeric($_POST["one_spells"])) $errors[] = "Class 1 Spells must be a number.";
if ($_POST["two_exp"] == "") $errors[] = "Class 2 Experience is required.";
if ($_POST["two_hp"] == "") $errors[] = "Class 2 HP is required.";
if ($_POST["two_mp"] == "") $errors[] = "Class 2 MP is required.";
if ($_POST["two_tp"] == "") $errors[] = "Class 2 TP is required.";
if ($_POST["two_strength"] == "") $errors[] = "Class 2 Strength is required.";
if ($_POST["two_dexterity"] == "") $errors[] = "Class 2 Dexterity is required.";
if ($_POST["two_spells"] == "") $errors[] = "Class 2 Spells is required.";
if (!is_numeric($_POST["two_exp"])) $errors[] = "Class 2 Experience must be a number.";
if (!is_numeric($_POST["two_hp"])) $errors[] = "Class 2 HP must be a number.";
if (!is_numeric($_POST["two_mp"])) $errors[] = "Class 2 MP must be a number.";
if (!is_numeric($_POST["two_tp"])) $errors[] = "Class 2 TP must be a number.";
if (!is_numeric($_POST["two_strength"])) $errors[] = "Class 2 Strength must be a number.";
if (!is_numeric($_POST["two_dexterity"])) $errors[] = "Class 2 Dexterity must be a number.";
if (!is_numeric($_POST["two_spells"])) $errors[] = "Class 2 Spells must be a number.";
if ($_POST["three_exp"] == "") $errors[] = "Class 3 Experience is required.";
if ($_POST["three_hp"] == "") $errors[] = "Class 3 HP is required.";
if ($_POST["three_mp"] == "") $errors[] = "Class 3 MP is required.";
if ($_POST["three_tp"] == "") $errors[] = "Class 3 TP is required.";
if ($_POST["three_strength"] == "") $errors[] = "Class 3 Strength is required.";
if ($_POST["three_dexterity"] == "") $errors[] = "Class 3 Dexterity is required.";
if ($_POST["three_spells"] == "") $errors[] = "Class 3 Spells is required.";
if (!is_numeric($_POST["three_exp"])) $errors[] = "Class 3 Experience must be a number.";
if (!is_numeric($_POST["three_hp"])) $errors[] = "Class 3 HP must be a number.";
if (!is_numeric($_POST["three_mp"])) $errors[] = "Class 3 MP must be a number.";
if (!is_numeric($_POST["three_tp"])) $errors[] = "Class 3 TP must be a number.";
if (!is_numeric($_POST["three_strength"])) $errors[] = "Class 3 Strength must be a number.";
if (!is_numeric($_POST["three_dexterity"])) $errors[] = "Class 3 Dexterity must be a number.";
if (!is_numeric($_POST["three_spells"])) $errors[] = "Class 3 Spells must be a number.";
if (count($errors) === 0) {
$updatequery = <<query($updatequery, [
$one_exp, $one_hp, $one_mp, $one_tp, $one_strength, $one_dexterity, $one_spells,
$two_exp, $two_hp, $two_mp, $two_tp, $two_strength, $two_dexterity, $two_spells,
$three_exp, $three_hp, $three_mp, $three_tp, $three_strength, $three_dexterity, $three_spells,
$id
]);
admindisplay("Level updated.", "Edit Levels");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit Spells");
}
}
$row = db()->query('SELECT * FROM levels WHERE id=? LIMIT 1;', [$id])->fetchArray(SQLITE3_ASSOC);
global $controlrow;
$class1name = $controlrow["class1name"];
$class2name = $controlrow["class2name"];
$class3name = $controlrow["class3name"];
$page = <<Edit Levels
Experience values for each level should be the cumulative total amount of experience up to this point. All other values should be only the new amount to add this level.
HTML;
admindisplay(parsetemplate($page, $row), "Edit Levels");
}
function users()
{
$page = "Edit Users Click a username to edit the account.
\n";
$users = db()->query('SELECT id, username FROM users ORDER BY id;');
$has_users = false;
while ($row = $users->fetchArray(SQLITE3_ASSOC)) {
$has_users = true;
$page .= "
", "Edit Users");
}
function edituser($id)
{
if (isset($_POST["submit"])) {
extract($_POST);
$errors = [];
if ($email == "") $errors[] = "Email is required.";
if ($verify == "") $errors[] = "Verify is required.";
if ($authlevel == "") $errors[] = "Auth Level is required.";
if ($latitude == "") $errors[] = "Latitude is required.";
if ($longitude == "") $errors[] = "Longitude is required.";
if ($charclass == "") $errors[] = "Character Class is required.";
if ($currentaction == "") $errors[] = "Current Action is required.";
if ($currentfight == "") $errors[] = "Current Fight is required.";
if ($currentmonster == "") $errors[] = "Current Monster is required.";
if ($currentmonsterhp == "") $errors[] = "Current Monster HP is required.";
if ($currentmonstersleep == "") $errors[] = "Current Monster Sleep is required.";
if ($currentmonsterimmune == "") $errors[] = "Current Monster Immune is required.";
if ($currentuberdamage == "") $errors[] = "Current Uber Damage is required.";
if ($currentuberdefense == "") $errors[] = "Current Uber Defense is required.";
if ($currenthp == "") $errors[] = "Current HP is required.";
if ($currentmp == "") $errors[] = "Current MP is required.";
if ($currenttp == "") $errors[] = "Current TP is required.";
if ($maxhp == "") $errors[] = "Max HP is required.";
if ($maxmp == "") $errors[] = "Max MP is required.";
if ($maxtp == "") $errors[] = "Max TP is required.";
if ($level == "") $errors[] = "Level is required.";
if ($gold == "") $errors[] = "Gold is required.";
if ($experience == "") $errors[] = "Experience is required.";
if ($goldbonus == "") $errors[] = "Gold Bonus is required.";
if ($expbonus == "") $errors[] = "Experience Bonus is required.";
if ($strength == "") $errors[] = "Strength is required.";
if ($dexterity == "") $errors[] = "Dexterity is required.";
if ($attackpower == "") $errors[] = "Attack Power is required.";
if ($defensepower == "") $errors[] = "Defense Power is required.";
if ($weaponid == "") $errors[] = "Weapon ID is required.";
if ($armorid == "") $errors[] = "Armor ID is required.";
if ($shieldid == "") $errors[] = "Shield ID is required.";
if ($slot1id == "") $errors[] = "Slot 1 ID is required.";
if ($slot2id == "") $errors[] = "Slot 2 ID is required.";
if ($slot3id == "") $errors[] = "Slot 3 ID is required.";
if ($weaponname == "") $errors[] = "Weapon Name is required.";
if ($armorname == "") $errors[] = "Armor Name is required.";
if ($shieldname == "") $errors[] = "Shield Name is required.";
if ($slot1name == "") $errors[] = "Slot 1 Name is required.";
if ($slot2name == "") $errors[] = "Slot 2 Name is required.";
if ($slot3name == "") $errors[] = "Slot 3 Name is required.";
if ($dropcode == "") $errors[] = "Drop Code is required.";
if ($spells == "") $errors[] = "Spells is required.";
if ($towns == "") $errors[] = "Towns is required.";
if (!is_numeric($authlevel)) $errors[] = "Auth Level must be a number.";
if (!is_numeric($latitude)) $errors[] = "Latitude must be a number.";
if (!is_numeric($longitude)) $errors[] = "Longitude must be a number.";
if (!is_numeric($charclass)) $errors[] = "Character Class must be a number.";
if (!is_numeric($currentfight)) $errors[] = "Current Fight must be a number.";
if (!is_numeric($currentmonster)) $errors[] = "Current Monster must be a number.";
if (!is_numeric($currentmonsterhp)) $errors[] = "Current Monster HP must be a number.";
if (!is_numeric($currentmonstersleep)) $errors[] = "Current Monster Sleep must be a number.";
if (!is_numeric($currentmonsterimmune)) $errors[] = "Current Monster Immune must be a number.";
if (!is_numeric($currentuberdamage)) $errors[] = "Current Uber Damage must be a number.";
if (!is_numeric($currentuberdefense)) $errors[] = "Current Uber Defense must be a number.";
if (!is_numeric($currenthp)) $errors[] = "Current HP must be a number.";
if (!is_numeric($currentmp)) $errors[] = "Current MP must be a number.";
if (!is_numeric($currenttp)) $errors[] = "Current TP must be a number.";
if (!is_numeric($maxhp)) $errors[] = "Max HP must be a number.";
if (!is_numeric($maxmp)) $errors[] = "Max MP must be a number.";
if (!is_numeric($maxtp)) $errors[] = "Max TP must be a number.";
if (!is_numeric($level)) $errors[] = "Level must be a number.";
if (!is_numeric($gold)) $errors[] = "Gold must be a number.";
if (!is_numeric($experience)) $errors[] = "Experience must be a number.";
if (!is_numeric($goldbonus)) $errors[] = "Gold Bonus must be a number.";
if (!is_numeric($expbonus)) $errors[] = "Experience Bonus must be a number.";
if (!is_numeric($strength)) $errors[] = "Strength must be a number.";
if (!is_numeric($dexterity)) $errors[] = "Dexterity must be a number.";
if (!is_numeric($attackpower)) $errors[] = "Attack Power must be a number.";
if (!is_numeric($defensepower)) $errors[] = "Defense Power must be a number.";
if (!is_numeric($weaponid)) $errors[] = "Weapon ID must be a number.";
if (!is_numeric($armorid)) $errors[] = "Armor ID must be a number.";
if (!is_numeric($shieldid)) $errors[] = "Shield ID must be a number.";
if (!is_numeric($slot1id)) $errors[] = "Slot 1 ID must be a number.";
if (!is_numeric($slot2id)) $errors[] = "Slot 2 ID must be a number.";
if (!is_numeric($slot3id)) $errors[] = "Slot 3 ID must be a number.";
if (!is_numeric($dropcode)) $errors[] = "Drop Code must be a number.";
if (count($errors) === 0) {
$updatequery = <<query($updatequery, [
$email, $verify, $authlevel, $latitude, $longitude, $charclass, $currentaction,
$currentfight, $currentmonster, $currentmonsterhp, $currentmonstersleep, $currentmonsterimmune,
$currentuberdamage, $currentuberdefense, $currenthp, $currentmp, $currenttp, $maxhp,
$maxmp, $maxtp, $level, $gold, $experience, $goldbonus, $expbonus, $strength,
$dexterity, $attackpower, $defensepower, $weaponid, $armorid, $shieldid, $slot1id,
$slot2id, $slot3id, $weaponname, $armorname, $shieldname, $slot1name, $slot2name,
$slot3name, $dropcode, $spells, $towns, $id
]);
admindisplay("User updated.", "Edit Users");
} else {
$errorlist = implode(' ', $errors);
admindisplay("Errors:
$errorlist
Please go back and try again.", "Edit Users");
}
}
$row = db()->query('SELECT * FROM users WHERE id = ? LIMIT 1;', [$id])->fetchArray(SQLITE3_ASSOC);
global $controlrow;
$class1name = $controlrow["class1name"];
$class2name = $controlrow["class2name"];
$class3name = $controlrow["class3name"];
$page = <<Edit Users