game before using 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"); $controlrow = mysql_fetch_array($controlquery); if (isset($_GET["do"])) { $do = explode(":",$_GET["do"]); if ($do[0] == "main") { main(); } elseif ($do[0] == "items") { items(); } elseif ($do[0] == "edititem") { edititem($do[1]); } elseif ($do[0] == "drops") { drops(); } elseif ($do[0] == "editdrop") { editdrop($do[1]); } elseif ($do[0] == "towns") { towns(); } elseif ($do[0] == "edittown") { edittown($do[1]); } elseif ($do[0] == "monsters") { monsters(); } elseif ($do[0] == "editmonster") { editmonster($do[1]); } elseif ($do[0] == "levels") { levels(); } elseif ($do[0] == "editlevel") { editlevel(); } elseif ($do[0] == "spells") { spells(); } elseif ($do[0] == "editspell") { editspell($do[1]); } elseif ($do[0] == "users") { users(); } elseif ($do[0] == "edituser") { edituser($do[1]); } elseif ($do[0] == "news") { addnews(); } } else { donothing(); } function donothing() { $page = "Welcome to the Dragon Knight Administration section. Use the links on the left bar to control and edit various elements of the game.

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."; display($page, "Admin Home"); } function main() { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($gamename == "") { $errors++; $errorlist .= "Game name is required.
"; } if (($gamesize % 5) != 0) { $errors++; $errorlist .= "Map size must be divisible by five.
"; } if (!is_numeric($gamesize)) { $errors++; $errorlist .= "Map size must be a number.
"; } if ($forumtype == 2 && $forumaddress == "") { $errors++; $errorlist .= "You must specify a forum address when using the External setting.
"; } if ($class1name == "") { $errors++; $errorlist .= "Class 1 name is required.
"; } if ($class2name == "") { $errors++; $errorlist .= "Class 2 name is required.
"; } if ($class3name == "") { $errors++; $errorlist .= "Class 3 name is required.
"; } if ($diff1name == "") { $errors++; $errorlist .= "Difficulty 1 name is required.
"; } if ($diff2name == "") { $errors++; $errorlist .= "Difficulty 2 name is required.
"; } if ($diff3name == "") { $errors++; $errorlist .= "Difficulty 3 name is required.
"; } if ($diff2mod == "") { $errors++; $errorlist .= "Difficulty 2 value is required.
"; } if ($diff3mod == "") { $errors++; $errorlist .= "Difficulty 3 value is required.
"; } if ($errors == 0) { $query = doquery("UPDATE {{table}} SET gamename='$gamename',gamesize='$gamesize',forumtype='$forumtype',forumaddress='$forumaddress',compression='$compression',class1name='$class1name',class2name='$class2name',class3name='$class3name',diff1name='$diff1name',diff2name='$diff2name',diff3name='$diff3name',diff2mod='$diff2mod',diff3mod='$diff3mod',gameopen='$gameopen',verifyemail='$verifyemail',gameurl='$gameurl',adminemail='$adminemail',shownews='$shownews',showonline='$showonline',showbabble='$showbabble' WHERE id='1' LIMIT 1", "control"); display("Settings updated.","Main Settings"); } else { display("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.

Game Open:
Close the game if you are upgrading or working on settings and don't want to cause odd errors for end-users. Closing the game will completely halt all activity.
Game Name:
Default is "Dragon Knight". Change this if you want to change to call your game something different.
Game URL:
Please specify the full URL to your game installation ("http://www.server.com/dkpath/index.php"). This gets used in the registration email sent to users. If you leave this field blank or incorrect, users may not be able to register correctly.
Admin Email:
Please specify your email address. This gets used when the game has to send an email to users.
Map Size:
Default is 250. This is the size of each map quadrant. Note that monster levels increase every 5 spaces, so you should ensure that you have at least (map size / 5) monster levels total, otherwise there will be parts of the map without any monsters, or some monsters won't ever get used. Ex: with a map size of 250, you should have 50 monster levels total.
Forum Type:
'Disabled' removes the forum link. 'Internal' uses the built-in (and very stripped-down) forum program included with Dragon Knight, if you don't have your own forums software already installed. 'External' uses the address provided below and links to your own forums software.
External Forum:
If the above value is set to 'External,' please specify the complete URL to your forums here.
Page Compression:
Enable page compression if it is supported by your server, and this will greatly reduce the amount of bandwidth required by the game.
Email Verification:
Make users verify their email address for added security.
Show News:
Toggle display of the Latest News box in towns.
Show Who's Online:
Toggle display of the Who's Online box in towns.
Show Babblebox:
Toggle display of the Babble Box in towns.
Class 1 Name:
Class 2 Name:
Class 3 Name:
Difficulty 1 Name:
Difficulty 2 Name:
Difficulty 2 Value:
Default is 1.2. Specify factoral value for medium difficulty here.
Difficulty 3 Name:
Difficulty 3 Value:
Default is 1.5. Specify factoral value for hard difficulty here.
END; if ($controlrow["forumtype"] == 0) { $controlrow["selecttype0"] = "selected=\"selected\" "; } else { $controlrow["selecttype0"] = ""; } if ($controlrow["forumtype"] == 1) { $controlrow["selecttype1"] = "selected=\"selected\" "; } else { $controlrow["selecttype1"] = ""; } if ($controlrow["forumtype"] == 2) { $controlrow["selecttype2"] = "selected=\"selected\" "; } else { $controlrow["selecttype2"] = ""; } if ($controlrow["compression"] == 0) { $controlrow["selectcomp0"] = "selected=\"selected\" "; } else { $controlrow["selectcomp0"] = ""; } if ($controlrow["compression"] == 1) { $controlrow["selectcomp1"] = "selected=\"selected\" "; } else { $controlrow["selectcomp1"] = ""; } 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"] = ""; } $page = parsetemplate($page, $controlrow); display($page, "Main Settings"); } function items() { $query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "items"); $page = "Edit Items
Click an item's name to edit it.

\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "\n"; $count = 2; } else { $page .= "\n"; $count = 1; } } if (mysql_num_rows($query) == 0) { $page .= "\n"; } $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No items found.
"; display($page, "Edit Items"); } function edititem($id) { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } if ($buycost == "") { $errors++; $errorlist .= "Cost is required.
"; } if (!is_numeric($buycost)) { $errors++; $errorlist .= "Cost must be a number.
"; } if ($attribute == "") { $errors++; $errorlist .= "Attribute is required.
"; } if (!is_numeric($attribute)) { $errors++; $errorlist .= "Attribute must be a number.
"; } if ($special == "" || $special == " ") { $special = "X"; } if ($errors == 0) { $query = doquery("UPDATE {{table}} SET name='$name',type='$type',buycost='$buycost',attribute='$attribute',special='$special' WHERE id='$id' LIMIT 1", "items"); display("Item updated.","Edit Items"); } else { display("Errors:
$errorlist

Please go back and try again.", "Edit Items"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items"); $row = mysql_fetch_array($query); $page = <<Edit Items

ID:{{id}}
Name:
Type:
Cost: gold
Attribute:
How much the item adds to total attackpower (weapons) or defensepower (armor/shields).
Special:
Should be either a special code or X to disable. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.
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 END; 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"] = ""; } $page = parsetemplate($page, $row); display($page, "Edit Items"); } function drops() { $query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "drops"); $page = "Edit Drops
Click an item's name to edit it.

\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "\n"; $count = 2; } else { $page .= "\n"; $count = 1; } } if (mysql_num_rows($query) == 0) { $page .= "\n"; } $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No items found.
"; display($page, "Edit Drops"); } function editdrop($id) { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } if ($mlevel == "") { $errors++; $errorlist .= "Monster level is required.
"; } if (!is_numeric($mlevel)) { $errors++; $errorlist .= "Monster level must be a number.
"; } if ($attribute1 == "" || $attribute1 == " " || $attribute1 == "X") { $errors++; $errorlist .= "First attribute is required.
"; } if ($attribute2 == "" || $attribute2 == " ") { $attribute2 = "X"; } if ($errors == 0) { $query = doquery("UPDATE {{table}} SET name='$name',mlevel='$mlevel',attribute1='$attribute1',attribute2='$attribute2' WHERE id='$id' LIMIT 1", "drops"); display("Item updated.","Edit Drops"); } else { display("Errors:
$errorlist

Please go back and try again.", "Edit Drops"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "drops"); $row = mysql_fetch_array($query); $page = <<Edit Drops

ID:{{id}}
Name:
Monster Level:
Minimum monster level that will drop this item.
Attribute 1:
Must be a special code. First attribute cannot be disabled. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.
Attribute 2:
Should be either a special code or X to disable. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.
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 END; $page = parsetemplate($page, $row); display($page, "Edit Drops"); } function towns() { $query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "towns"); $page = "Edit Towns
Click an town's name to edit it.

\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "\n"; $count = 2; } else { $page .= "\n"; $count = 1; } } if (mysql_num_rows($query) == 0) { $page .= "\n"; } $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No towns found.
"; display($page, "Edit Towns"); } function edittown($id) { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } if ($latitude == "") { $errors++; $errorlist .= "Latitude is required.
"; } if (!is_numeric($latitude)) { $errors++; $errorlist .= "Latitude must be a number.
"; } if ($longitude == "") { $errors++; $errorlist .= "Longitude is required.
"; } if (!is_numeric($longitude)) { $errors++; $errorlist .= "Longitude must be a number.
"; } if ($innprice == "") { $errors++; $errorlist .= "Inn Price is required.
"; } if (!is_numeric($innprice)) { $errors++; $errorlist .= "Inn Price must be a number.
"; } if ($mapprice == "") { $errors++; $errorlist .= "Map Price is required.
"; } if (!is_numeric($mapprice)) { $errors++; $errorlist .= "Map Price must be a number.
"; } if ($travelpoints == "") { $errors++; $errorlist .= "Travel Points is required.
"; } if (!is_numeric($travelpoints)) { $errors++; $errorlist .= "Travel Points must be a number.
"; } if ($itemslist == "") { $errors++; $errorlist .= "Items List is required.
"; } if ($errors == 0) { $query = doquery("UPDATE {{table}} SET name='$name',latitude='$latitude',longitude='$longitude',innprice='$innprice',mapprice='$mapprice',travelpoints='$travelpoints',itemslist='$itemslist' WHERE id='$id' LIMIT 1", "towns"); display("Town updated.","Edit Towns"); } else { display("Errors:
$errorlist

Please go back and try again.", "Edit Towns"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns"); $row = mysql_fetch_array($query); $page = <<Edit Towns

ID:{{id}}
Name:
Latitude:
Positive or negative integer.
Longitude:
Positive or negative integer.
Inn Price: gold
Map Price: gold
How much it costs to buy the map to this town.
Travel Points:
How many TP are consumed when travelling to this town.
Items List:
Comma-separated list of item ID numbers available for purchase at this town. (Example: 1,2,3,6,9,10,13,20)
END; $page = parsetemplate($page, $row); display($page, "Edit Towns"); } function monsters() { global $controlrow; $statquery = doquery("SELECT * FROM {{table}} ORDER BY level DESC LIMIT 1", "monsters"); $statrow = mysql_fetch_array($statquery); $query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "monsters"); $page = "Edit Monsters
"; if (($controlrow["gamesize"]/5) != $statrow["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 ".$statrow["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.

\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "\n"; $count = 2; } else { $page .= "\n"; $count = 1; } } if (mysql_num_rows($query) == 0) { $page .= "\n"; } $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No towns found.
"; display($page, "Edit Monster"); } function editmonster($id) { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.
"; } if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.
"; } if ($maxdam == "") { $errors++; $errorlist .= "Max Damage is required.
"; } if (!is_numeric($maxdam)) { $errors++; $errorlist .= "Max Damage must be a number.
"; } if ($armor == "") { $errors++; $errorlist .= "Armor is required.
"; } if (!is_numeric($armor)) { $errors++; $errorlist .= "Armor must be a number.
"; } if ($level == "") { $errors++; $errorlist .= "Monster Level is required.
"; } if (!is_numeric($level)) { $errors++; $errorlist .= "Monster Level must be a number.
"; } if ($maxexp == "") { $errors++; $errorlist .= "Max Exp is required.
"; } if (!is_numeric($maxexp)) { $errors++; $errorlist .= "Max Exp must be a number.
"; } if ($maxgold == "") { $errors++; $errorlist .= "Max Gold is required.
"; } if (!is_numeric($maxgold)) { $errors++; $errorlist .= "Max Gold must be a number.
"; } if ($errors == 0) { $query = doquery("UPDATE {{table}} SET name='$name',maxhp='$maxhp',maxdam='$maxdam',armor='$armor',level='$level',maxexp='$maxexp',maxgold='$maxgold',immune='$immune' WHERE id='$id' LIMIT 1", "monsters"); display("Monster updated.","Edit monsters"); } else { display("Errors:
$errorlist

Please go back and try again.", "Edit monsters"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "monsters"); $row = mysql_fetch_array($query); $page = <<Edit Monsters

ID:{{id}}
Name:
Max Hit Points:
Max Damage:
Compares to player's attackpower.
Armor:
Compares to player's defensepower.
Monster Level:
Determines spawn location and item drops.
Max Experience:
Max experience gained from defeating monster.
Max Gold:
Max gold gained from defeating monster.
Immunity:
Some monsters may not be hurt by certain spells.
END; 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"] = ""; } $page = parsetemplate($page, $row); display($page, "Edit Monsters"); } function spells() { $query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "spells"); $page = "Edit Spells
Click an spell's name to edit it.

\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "\n"; $count = 2; } else { $page .= "\n"; $count = 1; } } if (mysql_num_rows($query) == 0) { $page .= "\n"; } $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No spells found.
"; display($page, "Edit Spells"); } function editspell($id) { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } if ($mp == "") { $errors++; $errorlist .= "MP is required.
"; } if (!is_numeric($mp)) { $errors++; $errorlist .= "MP must be a number.
"; } if ($attribute == "") { $errors++; $errorlist .= "Attribute is required.
"; } if (!is_numeric($attribute)) { $errors++; $errorlist .= "Attribute must be a number.
"; } if ($errors == 0) { $query = doquery("UPDATE {{table}} SET name='$name',mp='$mp',attribute='$attribute',type='$type' WHERE id='$id' LIMIT 1", "spells"); display("Spell updated.","Edit Spells"); } else { display("Errors:
$errorlist

Please go back and try again.", "Edit Spells"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells"); $row = mysql_fetch_array($query); $page = <<Edit Spells

ID:{{id}}
Name:
Magic Points:
MP required to cast spell.
Attribute:
Numeric value of the spell's effect. Ties with type, below.
Type:
- Heal gives player back [attribute] hit points.
- Hurt deals [attribute] damage to monster.
- Sleep keeps monster from attacking ([attribute] is monster's chance out of 15 to stay asleep each turn).
- Uber Attack increases total attack damage by [attribute] percent.
- Uber Defense increases total defense from attack by [attribute] percent.
END; 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"] = ""; } $page = parsetemplate($page, $row); display($page, "Edit Spells"); } function levels() { $query = doquery("SELECT id FROM {{table}} ORDER BY id DESC LIMIT 1", "levels"); $row = mysql_fetch_array($query); $options = ""; for($i=2; $i<$row["id"]; $i++) { $options .= "\n"; } $page = <<Edit Levels
Select a level number from the dropdown box to edit it.

END; display($page, "Edit Levels"); } function editlevel() { if (!isset($_POST["level"])) { display("No level to edit.", "Edit Levels"); die(); } $id = $_POST["level"]; if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($_POST["1_exp"] == "") { $errors++; $errorlist .= "Class 1 Experience is required.
"; } if ($_POST["1_hp"] == "") { $errors++; $errorlist .= "Class 1 HP is required.
"; } if ($_POST["1_mp"] == "") { $errors++; $errorlist .= "Class 1 MP is required.
"; } if ($_POST["1_tp"] == "") { $errors++; $errorlist .= "Class 1 TP is required.
"; } if ($_POST["1_strength"] == "") { $errors++; $errorlist .= "Class 1 Strength is required.
"; } if ($_POST["1_dexterity"] == "") { $errors++; $errorlist .= "Class 1 Dexterity is required.
"; } if ($_POST["1_spells"] == "") { $errors++; $errorlist .= "Class 1 Spells is required.
"; } if (!is_numeric($_POST["1_exp"])) { $errors++; $errorlist .= "Class 1 Experience must be a number.
"; } if (!is_numeric($_POST["1_hp"])) { $errors++; $errorlist .= "Class 1 HP must be a number.
"; } if (!is_numeric($_POST["1_mp"])) { $errors++; $errorlist .= "Class 1 MP must be a number.
"; } if (!is_numeric($_POST["1_tp"])) { $errors++; $errorlist .= "Class 1 TP must be a number.
"; } if (!is_numeric($_POST["1_strength"])) { $errors++; $errorlist .= "Class 1 Strength must be a number.
"; } if (!is_numeric($_POST["1_dexterity"])) { $errors++; $errorlist .= "Class 1 Dexterity must be a number.
"; } if (!is_numeric($_POST["1_spells"])) { $errors++; $errorlist .= "Class 1 Spells must be a number.
"; } if ($_POST["2_exp"] == "") { $errors++; $errorlist .= "Class 2 Experience is required.
"; } if ($_POST["2_hp"] == "") { $errors++; $errorlist .= "Class 2 HP is required.
"; } if ($_POST["2_mp"] == "") { $errors++; $errorlist .= "Class 2 MP is required.
"; } if ($_POST["2_tp"] == "") { $errors++; $errorlist .= "Class 2 TP is required.
"; } if ($_POST["2_strength"] == "") { $errors++; $errorlist .= "Class 2 Strength is required.
"; } if ($_POST["2_dexterity"] == "") { $errors++; $errorlist .= "Class 2 Dexterity is required.
"; } if ($_POST["2_spells"] == "") { $errors++; $errorlist .= "Class 2 Spells is required.
"; } if (!is_numeric($_POST["2_exp"])) { $errors++; $errorlist .= "Class 2 Experience must be a number.
"; } if (!is_numeric($_POST["2_hp"])) { $errors++; $errorlist .= "Class 2 HP must be a number.
"; } if (!is_numeric($_POST["2_mp"])) { $errors++; $errorlist .= "Class 2 MP must be a number.
"; } if (!is_numeric($_POST["2_tp"])) { $errors++; $errorlist .= "Class 2 TP must be a number.
"; } if (!is_numeric($_POST["2_strength"])) { $errors++; $errorlist .= "Class 2 Strength must be a number.
"; } if (!is_numeric($_POST["2_dexterity"])) { $errors++; $errorlist .= "Class 2 Dexterity must be a number.
"; } if (!is_numeric($_POST["2_spells"])) { $errors++; $errorlist .= "Class 2 Spells must be a number.
"; } if ($_POST["3_exp"] == "") { $errors++; $errorlist .= "Class 3 Experience is required.
"; } if ($_POST["3_hp"] == "") { $errors++; $errorlist .= "Class 3 HP is required.
"; } if ($_POST["3_mp"] == "") { $errors++; $errorlist .= "Class 3 MP is required.
"; } if ($_POST["3_tp"] == "") { $errors++; $errorlist .= "Class 3 TP is required.
"; } if ($_POST["3_strength"] == "") { $errors++; $errorlist .= "Class 3 Strength is required.
"; } if ($_POST["3_dexterity"] == "") { $errors++; $errorlist .= "Class 3 Dexterity is required.
"; } if ($_POST["3_spells"] == "") { $errors++; $errorlist .= "Class 3 Spells is required.
"; } if (!is_numeric($_POST["3_exp"])) { $errors++; $errorlist .= "Class 3 Experience must be a number.
"; } if (!is_numeric($_POST["3_hp"])) { $errors++; $errorlist .= "Class 3 HP must be a number.
"; } if (!is_numeric($_POST["3_mp"])) { $errors++; $errorlist .= "Class 3 MP must be a number.
"; } if (!is_numeric($_POST["3_tp"])) { $errors++; $errorlist .= "Class 3 TP must be a number.
"; } if (!is_numeric($_POST["3_strength"])) { $errors++; $errorlist .= "Class 3 Strength must be a number.
"; } if (!is_numeric($_POST["3_dexterity"])) { $errors++; $errorlist .= "Class 3 Dexterity must be a number.
"; } if (!is_numeric($_POST["3_spells"])) { $errors++; $errorlist .= "Class 3 Spells must be a number.
"; } if ($errors == 0) { $updatequery = <<Errors:
$errorlist

Please go back and try again.", "Edit Spells"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "levels"); $row = mysql_fetch_array($query); 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.

ID:{{id}}
 
$class1name Experience:
$class1name HP:
$class1name MP:
$class1name TP:
$class1name Strength:
$class1name Dexterity:
$class1name Spells:
 
$class2name Experience:
$class2name HP:
$class2name MP:
$class2name TP:
$class2name Strength:
$class2name Dexterity:
$class2name Spells:
 
$class3name Experience:
$class3name HP:
$class3name MP:
$class3name TP:
$class3name Strength:
$class3name Dexterity:
$class3name Spells:
END; $page = parsetemplate($page, $row); display($page, "Edit Levels"); } function users() { $query = doquery("SELECT id,username FROM {{table}} ORDER BY id", "users"); $page = "Edit Users
Click a username to edit the account.

\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "\n"; $count = 2; } else { $page .= "\n"; $count = 1; } } if (mysql_num_rows($query) == 0) { $page .= "\n"; } $page .= "
".$row["id"]."".$row["username"]."
".$row["id"]."".$row["username"]."
No spells found.
"; display($page, "Edit Users"); } function edituser($id) { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($email == "") { $errors++; $errorlist .= "Email is required.
"; } if ($verify == "") { $errors++; $errorlist .= "Verify is required.
"; } if ($charname == "") { $errors++; $errorlist .= "Character Name is required.
"; } if ($authlevel == "") { $errors++; $errorlist .= "Auth Level is required.
"; } if ($latitude == "") { $errors++; $errorlist .= "Latitude is required.
"; } if ($longitude == "") { $errors++; $errorlist .= "Longitude is required.
"; } if ($difficulty == "") { $errors++; $errorlist .= "Difficulty is required.
"; } if ($charclass == "") { $errors++; $errorlist .= "Character Class is required.
"; } if ($currentaction == "") { $errors++; $errorlist .= "Current Action is required.
"; } if ($currentfight == "") { $errors++; $errorlist .= "Current Fight is required.
"; } if ($currentmonster == "") { $errors++; $errorlist .= "Current Monster is required.
"; } if ($currentmonsterhp == "") { $errors++; $errorlist .= "Current Monster HP is required.
"; } if ($currentmonstersleep == "") { $errors++; $errorlist .= "Current Monster Sleep is required.
"; } if ($currentmonsterimmune == "") { $errors++; $errorlist .= "Current Monster Immune is required.
"; } if ($currentuberdamage == "") { $errors++; $errorlist .= "Current Uber Damage is required.
"; } if ($currentuberdefense == "") { $errors++; $errorlist .= "Current Uber Defense is required.
"; } if ($currenthp == "") { $errors++; $errorlist .= "Current HP is required.
"; } if ($currentmp == "") { $errors++; $errorlist .= "Current MP is required.
"; } if ($currenttp == "") { $errors++; $errorlist .= "Current TP is required.
"; } if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.
"; } if ($maxmp == "") { $errors++; $errorlist .= "Max MP is required.
"; } if ($maxtp == "") { $errors++; $errorlist .= "Max TP is required.
"; } if ($level == "") { $errors++; $errorlist .= "Level is required.
"; } if ($gold == "") { $errors++; $errorlist .= "Gold is required.
"; } if ($experience == "") { $errors++; $errorlist .= "Experience is required.
"; } if ($goldbonus == "") { $errors++; $errorlist .= "Gold Bonus is required.
"; } if ($expbonus == "") { $errors++; $errorlist .= "Experience Bonus is required.
"; } if ($strength == "") { $errors++; $errorlist .= "Strength is required.
"; } if ($dexterity == "") { $errors++; $errorlist .= "Dexterity is required.
"; } if ($attackpower == "") { $errors++; $errorlist .= "Attack Power is required.
"; } if ($defensepower == "") { $errors++; $errorlist .= "Defense Power is required.
"; } if ($weaponid == "") { $errors++; $errorlist .= "Weapon ID is required.
"; } if ($armorid == "") { $errors++; $errorlist .= "Armor ID is required.
"; } if ($shieldid == "") { $errors++; $errorlist .= "Shield ID is required.
"; } if ($slot1id == "") { $errors++; $errorlist .= "Slot 1 ID is required.
"; } if ($slot2id == "") { $errors++; $errorlist .= "Slot 2 ID is required.
"; } if ($slot3id == "") { $errors++; $errorlist .= "Slot 3 ID is required.
"; } if ($weaponname == "") { $errors++; $errorlist .= "Weapon Name is required.
"; } if ($armorname == "") { $errors++; $errorlist .= "Armor Name is required.
"; } if ($shieldname == "") { $errors++; $errorlist .= "Shield Name is required.
"; } if ($slot1name == "") { $errors++; $errorlist .= "Slot 1 Name is required.
"; } if ($slot2name == "") { $errors++; $errorlist .= "Slot 2 Name is required.
"; } if ($slot3name == "") { $errors++; $errorlist .= "Slot 3 Name is required.
"; } if ($dropcode == "") { $errors++; $errorlist .= "Drop Code is required.
"; } if ($spells == "") { $errors++; $errorlist .= "Spells is required.
"; } if ($towns == "") { $errors++; $errorlist .= "Towns is required.
"; } if (!is_numeric($authlevel)) { $errors++; $errorlist .= "Auth Level must be a number.
"; } if (!is_numeric($latitude)) { $errors++; $errorlist .= "Latitude must be a number.
"; } if (!is_numeric($longitude)) { $errors++; $errorlist .= "Longitude must be a number.
"; } if (!is_numeric($difficulty)) { $errors++; $errorlist .= "Difficulty must be a number.
"; } if (!is_numeric($charclass)) { $errors++; $errorlist .= "Character Class must be a number.
"; } if (!is_numeric($currentfight)) { $errors++; $errorlist .= "Current Fight must be a number.
"; } if (!is_numeric($currentmonster)) { $errors++; $errorlist .= "Current Monster must be a number.
"; } if (!is_numeric($currentmonsterhp)) { $errors++; $errorlist .= "Current Monster HP must be a number.
"; } if (!is_numeric($currentmonstersleep)) { $errors++; $errorlist .= "Current Monster Sleep must be a number.
"; } if (!is_numeric($currentmonsterimmune)) { $errors++; $errorlist .= "Current Monster Immune must be a number.
"; } if (!is_numeric($currentuberdamage)) { $errors++; $errorlist .= "Current Uber Damage must be a number.
"; } if (!is_numeric($currentuberdefense)) { $errors++; $errorlist .= "Current Uber Defense must be a number.
"; } if (!is_numeric($currenthp)) { $errors++; $errorlist .= "Current HP must be a number.
"; } if (!is_numeric($currentmp)) { $errors++; $errorlist .= "Current MP must be a number.
"; } if (!is_numeric($currenttp)) { $errors++; $errorlist .= "Current TP must be a number.
"; } if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.
"; } if (!is_numeric($maxmp)) { $errors++; $errorlist .= "Max MP must be a number.
"; } if (!is_numeric($maxtp)) { $errors++; $errorlist .= "Max TP must be a number.
"; } if (!is_numeric($level)) { $errors++; $errorlist .= "Level must be a number.
"; } if (!is_numeric($gold)) { $errors++; $errorlist .= "Gold must be a number.
"; } if (!is_numeric($experience)) { $errors++; $errorlist .= "Experience must be a number.
"; } if (!is_numeric($goldbonus)) { $errors++; $errorlist .= "Gold Bonus must be a number.
"; } if (!is_numeric($expbonus)) { $errors++; $errorlist .= "Experience Bonus must be a number.
"; } if (!is_numeric($strength)) { $errors++; $errorlist .= "Strength must be a number.
"; } if (!is_numeric($dexterity)) { $errors++; $errorlist .= "Dexterity must be a number.
"; } if (!is_numeric($attackpower)) { $errors++; $errorlist .= "Attack Power must be a number.
"; } if (!is_numeric($defensepower)) { $errors++; $errorlist .= "Defense Power must be a number.
"; } if (!is_numeric($weaponid)) { $errors++; $errorlist .= "Weapon ID must be a number.
"; } if (!is_numeric($armorid)) { $errors++; $errorlist .= "Armor ID must be a number.
"; } if (!is_numeric($shieldid)) { $errors++; $errorlist .= "Shield ID must be a number.
"; } if (!is_numeric($slot1id)) { $errors++; $errorlist .= "Slot 1 ID must be a number.
"; } if (!is_numeric($slot2id)) { $errors++; $errorlist .= "Slot 2 ID must be a number.
"; } if (!is_numeric($slot3id)) { $errors++; $errorlist .= "Slot 3 ID must be a number.
"; } if (!is_numeric($dropcode)) { $errors++; $errorlist .= "Drop Code must be a number.
"; } if ($errors == 0) { $updatequery = <<Errors:
$errorlist

Please go back and try again.", "Edit Users"); } } $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users"); $row = mysql_fetch_array($query); global $controlrow; $diff1name = $controlrow["diff1name"]; $diff2name = $controlrow["diff2name"]; $diff3name = $controlrow["diff3name"]; $class1name = $controlrow["class1name"]; $class2name = $controlrow["class2name"]; $class3name = $controlrow["class3name"]; $page = <<Edit Users

ID:{{id}}
Username:{{username}}
Email:
Verify:
Character Name:
Register Date:{{regdate}}
Last Online:{{onlinetime}}
Auth Level:
Set to "Blocked" to temporarily (or permanently) ban a user.
 
Latitude:
Longitude:
Difficulty:
Character Class:
 
Current Action:
Current Fight:
Current Monster:
Current Monster HP:
Current Monster Sleep:
Current Monster Immune:
Current Uber Damage:
Current Uber Defense:
 
Current HP:
Current MP:
Current TP:
Max HP:
Max MP:
Max TP:
 
Level:
Gold:
Experience:
Gold Bonus:
Experience Bonus:
Strength:
Dexterity:
Attack Power:
Defense Power:
 
Weapon ID:
Armor ID:
Shield ID:
Slot 1 ID:
Slot 2 ID:
Slot 3 ID:
Weapon Name:
Armor Name:
Shield Name:
Slot 1 Name:
Slot 2 Name:
Slot 3 Name:
 
Drop Code:
Spells:
Towns:
END; if ($row["authlevel"] == 0) { $row["auth0select"] = "selected=\"selected\" "; } else { $row["auth0select"] = ""; } if ($row["authlevel"] == 1) { $row["auth1select"] = "selected=\"selected\" "; } else { $row["auth1select"] = ""; } if ($row["authlevel"] == 2) { $row["auth2select"] = "selected=\"selected\" "; } else { $row["auth2select"] = ""; } if ($row["charclass"] == 1) { $row["class1select"] = "selected=\"selected\" "; } else { $row["class1select"] = ""; } if ($row["charclass"] == 2) { $row["class2select"] = "selected=\"selected\" "; } else { $row["class2select"] = ""; } if ($row["charclass"] == 3) { $row["class3select"] = "selected=\"selected\" "; } else { $row["class3select"] = ""; } if ($row["difficulty"] == 1) { $row["diff1select"] = "selected=\"selected\" "; } else { $row["diff1select"] = ""; } if ($row["difficulty"] == 2) { $row["diff2select"] = "selected=\"selected\" "; } else { $row["diff2select"] = ""; } if ($row["difficulty"] == 3) { $row["diff3select"] = "selected=\"selected\" "; } else { $row["diff3select"] = ""; } $page = parsetemplate($page, $row); display($page, "Edit Users"); } function addnews() { if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($content == "") { $errors++; $errorlist .= "Content is required.
"; } if ($errors == 0) { $query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),content='$content'", "news"); display("News post added.","Add News"); } else { display("Errors:
$errorlist

Please go back and try again.", "Add News"); } } $page = <<Add A News Post

Type your post below and then click Submit to add it.

END; display($page, "Add News"); } ?>