diff --git a/admin/control.php b/admin/control.php
new file mode 100644
index 0000000..97a616e
--- /dev/null
+++ b/admin/control.php
@@ -0,0 +1,69 @@
+ $b) {
+ if (!is_numeric($_POST[$b])) { $errors .= "$b is a numeric field. Please enter numbers only. Please go back and try again.
"; }
+ }
+ foreach($_POST as $a => $b) {
+ if (trim($_POST[$a]) == "" && !in_array($a,$norequires)) { $errors .= "$a is a required field. Please enter a value. Please go back and try again.
"; }
+ }
+ if ($errors != "") { err($errors); }
+
+ // Check toggles.
+ foreach($toggles as $a => $b) {
+ if (!isset($_POST[$b])) { $_POST[$b] = "0"; }
+ }
+
+ // Build query.
+ $query = "";
+ $columns = dorow(doquery("SHOW COLUMNS FROM {{table}}", "control"));
+ foreach($columns as $a => $b) {
+ if (isset($_POST[$b["Field"]])) { $query .= $b["Field"] . "='" . $_POST[$b["Field"]] . "',"; }
+ }
+ $query = rtrim($query, ",");
+
+ // Save settings & finish.
+ doquery("UPDATE {{table}} SET $query WHERE id='1' LIMIT 1", "control");
+ display("Main Settings", "The main settings were saved successfully.
You may return Home or to the Main Settings page.");
+
+ }
+
+ extract($controlrow);
+
+ // Checkboxes.
+ if ($gameopen == 1) { $controlrow["check_gameopen"] = "checked=\"checked\""; } else { $controlrow["check_gameopen"] = ""; }
+ if ($showshout == 1) { $controlrow["check_showshout"] = "checked=\"checked\""; } else { $controlrow["check_showshout"] = ""; }
+ if ($showonline == 1) { $controlrow["check_showonline"] = "checked=\"checked\""; } else { $controlrow["check_showonline"] = ""; }
+ if ($showmonsterimages == 1) { $controlrow["check_showmonsterimages"] = "checked=\"checked\""; } else { $controlrow["check_showmonsterimages"] = ""; }
+ if ($verifyemail == 1) { $controlrow["check_verifyemail"] = "checked=\"checked\""; } else { $controlrow["check_verifyemail"] = ""; }
+ if ($compression == 1) { $controlrow["check_compression"] = "checked=\"checked\""; } else { $controlrow["check_compression"] = ""; }
+ if ($debug == 1) { $controlrow["check_debug"] = "checked=\"checked\""; } else { $controlrow["check_debug"] = ""; }
+
+ // Item image dropdown.
+ $itemimages = array(0=>"Off",1=>"Slot",2=>"ID");
+ $controlrow["select_showitemimages"] = "";
+ foreach($itemimages as $a => $b) {
+ if ($controlrow["showitemimages"] == $a) { $selected = "selected=\"selected=\""; } else { $selected = ""; }
+ $controlrow["select_showitemimages"] .= "";
+ }
+
+ $page = parsetemplate(gettemplate("control"), $controlrow);
+ display("Main Settings", $page);
+
+}
+
+?>
\ No newline at end of file
diff --git a/admin/cookies.php b/admin/cookies.php
new file mode 100644
index 0000000..ca508c1
--- /dev/null
+++ b/admin/cookies.php
@@ -0,0 +1,31 @@
+
\ No newline at end of file
diff --git a/admin/globals.php b/admin/globals.php
new file mode 100644
index 0000000..0a92d19
--- /dev/null
+++ b/admin/globals.php
@@ -0,0 +1,18 @@
+
\ No newline at end of file
diff --git a/admin/icons/bug.png b/admin/icons/bug.png
new file mode 100644
index 0000000..2d5fb90
Binary files /dev/null and b/admin/icons/bug.png differ
diff --git a/admin/icons/cog.png b/admin/icons/cog.png
new file mode 100644
index 0000000..67de2c6
Binary files /dev/null and b/admin/icons/cog.png differ
diff --git a/admin/icons/coins.png b/admin/icons/coins.png
new file mode 100644
index 0000000..0ca9074
Binary files /dev/null and b/admin/icons/coins.png differ
diff --git a/admin/icons/cross.png b/admin/icons/cross.png
new file mode 100644
index 0000000..1514d51
Binary files /dev/null and b/admin/icons/cross.png differ
diff --git a/admin/icons/delete.png b/admin/icons/delete.png
new file mode 100644
index 0000000..08f2493
Binary files /dev/null and b/admin/icons/delete.png differ
diff --git a/admin/icons/flag_blue.png b/admin/icons/flag_blue.png
new file mode 100644
index 0000000..003924f
Binary files /dev/null and b/admin/icons/flag_blue.png differ
diff --git a/admin/icons/group.png b/admin/icons/group.png
new file mode 100644
index 0000000..7fb4e1f
Binary files /dev/null and b/admin/icons/group.png differ
diff --git a/admin/icons/house.png b/admin/icons/house.png
new file mode 100644
index 0000000..fed6221
Binary files /dev/null and b/admin/icons/house.png differ
diff --git a/admin/icons/lightning.png b/admin/icons/lightning.png
new file mode 100644
index 0000000..9680afd
Binary files /dev/null and b/admin/icons/lightning.png differ
diff --git a/admin/icons/pencil.png b/admin/icons/pencil.png
new file mode 100644
index 0000000..0bfecd5
Binary files /dev/null and b/admin/icons/pencil.png differ
diff --git a/admin/icons/tick.png b/admin/icons/tick.png
new file mode 100644
index 0000000..a9925a0
Binary files /dev/null and b/admin/icons/tick.png differ
diff --git a/admin/icons/user.png b/admin/icons/user.png
new file mode 100644
index 0000000..79f35cc
Binary files /dev/null and b/admin/icons/user.png differ
diff --git a/admin/icons/world.png b/admin/icons/world.png
new file mode 100644
index 0000000..68f21d3
Binary files /dev/null and b/admin/icons/world.png differ
diff --git a/admin/icons/world_add.png b/admin/icons/world_add.png
new file mode 100644
index 0000000..6d0d7f7
Binary files /dev/null and b/admin/icons/world_add.png differ
diff --git a/admin/icons/world_delete.png b/admin/icons/world_delete.png
new file mode 100644
index 0000000..ffcd115
Binary files /dev/null and b/admin/icons/world_delete.png differ
diff --git a/admin/icons/world_edit.png b/admin/icons/world_edit.png
new file mode 100644
index 0000000..00794d4
Binary files /dev/null and b/admin/icons/world_edit.png differ
diff --git a/admin/icons/wrench.png b/admin/icons/wrench.png
new file mode 100644
index 0000000..5c8213f
Binary files /dev/null and b/admin/icons/wrench.png differ
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..ddca0b8
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/admin/lib.php b/admin/lib.php
new file mode 100644
index 0000000..083e45f
--- /dev/null
+++ b/admin/lib.php
@@ -0,0 +1,254 @@
+
$query");
+ $numqueries++;
+ return $sqlquery;
+
+}
+
+function dorow($sqlquery, $force = "") { // Abstraction layer part deux.
+
+ switch (mysql_num_rows($sqlquery)) {
+
+ case 0:
+ $row = false;
+ break;
+ case 1:
+ if ($force == "") {
+ $row = mysql_fetch_assoc($sqlquery);
+ } else {
+ $temprow = mysql_fetch_assoc($sqlquery);
+ $row[$temprow[$force]] = $temprow;
+ }
+ break;
+ default:
+ if ($force == "") {
+ while ($temprow = mysql_fetch_assoc($sqlquery)) {
+ $row[] = $temprow;
+ }
+ } else {
+ while ($temprow = mysql_fetch_assoc($sqlquery)) {
+ $row[$temprow[$force]] = $temprow;
+ }
+ }
+ break;
+
+ }
+
+ return $row;
+
+}
+
+function gettemplate($templatename) { // SQL query for the template.
+
+ $filename = "templates/" . $templatename . ".php";
+ include("$filename");
+ return $template;
+
+}
+
+function parsetemplate($template, $array) { // Replace template with proper content. Also does languages.
+
+ foreach($array as $a => $b) {
+ $template = str_replace("{{{$a}}}", $b, $template);
+ }
+ return $template;
+
+}
+
+function getmicrotime() { // Used for timing script operations.
+
+ list($usec, $sec) = explode(" ",microtime());
+ return ((float)$usec + (float)$sec);
+
+}
+
+function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net!
+
+ return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
+
+}
+
+function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
+
+ global $controlrow;
+ extract($controlrow);
+
+
+ $from = trim($from);
+
+ if (!$from) {
+ $from = '<$adminemail>';
+ }
+
+ $rp = $adminemail;
+ $org = '$gameurl';
+ $mailer = 'PHP';
+
+ $head = '';
+ $head .= "Content-Type: text/plain \r\n";
+ $head .= "Date: ". date('r'). " \r\n";
+ $head .= "Return-Path: $rp \r\n";
+ $head .= "From: $from \r\n";
+ $head .= "Sender: $from \r\n";
+ $head .= "Reply-To: $from \r\n";
+ $head .= "Organization: $org \r\n";
+ $head .= "X-Sender: $from \r\n";
+ $head .= "X-Priority: 3 \r\n";
+ $head .= "X-Mailer: $mailer \r\n";
+
+ $body = str_replace("\r\n", "\n", $body);
+ $body = str_replace("\n", "\r\n", $body);
+
+ return mail($to, $title, $body, $head);
+
+}
+
+function err($error, $system = false, $panels = true) { // Basic little error handler.
+
+ display("Error", $error, $panels);
+
+}
+
+function dotabs() {
+
+ global $thetab;
+
+ $tabs = array(
+ 1=>" Home",
+ 2=>" Config",
+ 3=>" Players",
+ 4=>" Items",
+ 5=>" Monsters",
+ 6=>" Spells",
+ 7=>" Guilds",
+ 8=>" Realms",
+ 9=>" Misc.",
+ 10=>" Tools"
+ );
+
+ $tabstrip = "";
+ foreach ($tabs as $a => $b) {
+ if ($thetab == $a) { $style = "tab_on"; } else { $style = "tab_off"; }
+ $tabstrip .= "