diff --git a/admin/admin.php b/admin/admin.php
index e818544..e7b8397 100644
--- a/admin/admin.php
+++ b/admin/admin.php
@@ -526,57 +526,57 @@ function editlevel() {
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["one_exp"] == "") { $errors++; $errorlist .= "Class 1 Experience is required. "; }
+ if ($_POST["one_hp"] == "") { $errors++; $errorlist .= "Class 1 HP is required. "; }
+ if ($_POST["one_mp"] == "") { $errors++; $errorlist .= "Class 1 MP is required. "; }
+ if ($_POST["one_tp"] == "") { $errors++; $errorlist .= "Class 1 TP is required. "; }
+ if ($_POST["one_strength"] == "") { $errors++; $errorlist .= "Class 1 Strength is required. "; }
+ if ($_POST["one_dexterity"] == "") { $errors++; $errorlist .= "Class 1 Dexterity is required. "; }
+ if ($_POST["one_spells"] == "") { $errors++; $errorlist .= "Class 1 Spells is required. "; }
+ if (!is_numeric($_POST["one_exp"])) { $errors++; $errorlist .= "Class 1 Experience must be a number. "; }
+ if (!is_numeric($_POST["one_hp"])) { $errors++; $errorlist .= "Class 1 HP must be a number. "; }
+ if (!is_numeric($_POST["one_mp"])) { $errors++; $errorlist .= "Class 1 MP must be a number. "; }
+ if (!is_numeric($_POST["one_tp"])) { $errors++; $errorlist .= "Class 1 TP must be a number. "; }
+ if (!is_numeric($_POST["one_strength"])) { $errors++; $errorlist .= "Class 1 Strength must be a number. "; }
+ if (!is_numeric($_POST["one_dexterity"])) { $errors++; $errorlist .= "Class 1 Dexterity must be a number. "; }
+ if (!is_numeric($_POST["one_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["two_exp"] == "") { $errors++; $errorlist .= "Class 2 Experience is required. "; }
+ if ($_POST["two_hp"] == "") { $errors++; $errorlist .= "Class 2 HP is required. "; }
+ if ($_POST["two_mp"] == "") { $errors++; $errorlist .= "Class 2 MP is required. "; }
+ if ($_POST["two_tp"] == "") { $errors++; $errorlist .= "Class 2 TP is required. "; }
+ if ($_POST["two_strength"] == "") { $errors++; $errorlist .= "Class 2 Strength is required. "; }
+ if ($_POST["two_dexterity"] == "") { $errors++; $errorlist .= "Class 2 Dexterity is required. "; }
+ if ($_POST["two_spells"] == "") { $errors++; $errorlist .= "Class 2 Spells is required. "; }
+ if (!is_numeric($_POST["two_exp"])) { $errors++; $errorlist .= "Class 2 Experience must be a number. "; }
+ if (!is_numeric($_POST["two_hp"])) { $errors++; $errorlist .= "Class 2 HP must be a number. "; }
+ if (!is_numeric($_POST["two_mp"])) { $errors++; $errorlist .= "Class 2 MP must be a number. "; }
+ if (!is_numeric($_POST["two_tp"])) { $errors++; $errorlist .= "Class 2 TP must be a number. "; }
+ if (!is_numeric($_POST["two_strength"])) { $errors++; $errorlist .= "Class 2 Strength must be a number. "; }
+ if (!is_numeric($_POST["two_dexterity"])) { $errors++; $errorlist .= "Class 2 Dexterity must be a number. "; }
+ if (!is_numeric($_POST["two_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 ($_POST["three_exp"] == "") { $errors++; $errorlist .= "Class 3 Experience is required. "; }
+ if ($_POST["three_hp"] == "") { $errors++; $errorlist .= "Class 3 HP is required. "; }
+ if ($_POST["three_mp"] == "") { $errors++; $errorlist .= "Class 3 MP is required. "; }
+ if ($_POST["three_tp"] == "") { $errors++; $errorlist .= "Class 3 TP is required. "; }
+ if ($_POST["three_strength"] == "") { $errors++; $errorlist .= "Class 3 Strength is required. "; }
+ if ($_POST["three_dexterity"] == "") { $errors++; $errorlist .= "Class 3 Dexterity is required. "; }
+ if ($_POST["three_spells"] == "") { $errors++; $errorlist .= "Class 3 Spells is required. "; }
+ if (!is_numeric($_POST["three_exp"])) { $errors++; $errorlist .= "Class 3 Experience must be a number. "; }
+ if (!is_numeric($_POST["three_hp"])) { $errors++; $errorlist .= "Class 3 HP must be a number. "; }
+ if (!is_numeric($_POST["three_mp"])) { $errors++; $errorlist .= "Class 3 MP must be a number. "; }
+ if (!is_numeric($_POST["three_tp"])) { $errors++; $errorlist .= "Class 3 TP must be a number. "; }
+ if (!is_numeric($_POST["three_strength"])) { $errors++; $errorlist .= "Class 3 Strength must be a number. "; }
+ if (!is_numeric($_POST["three_dexterity"])) { $errors++; $errorlist .= "Class 3 Dexterity must be a number. "; }
+ if (!is_numeric($_POST["three_spells"])) { $errors++; $errorlist .= "Class 3 Spells must be a number. "; }
if ($errors == 0) {
$updatequery = <<
-
$class1name Experience:
-
$class1name HP:
-
$class1name MP:
-
$class1name TP:
-
$class1name Strength:
-
$class1name Dexterity:
-
$class1name Spells:
+
$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:
+
$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:
+
$class3name Experience:
+
$class3name HP:
+
$class3name MP:
+
$class3name TP:
+
$class3name Strength:
+
$class3name Dexterity:
+
$class3name Spells:
diff --git a/fight.php b/fight.php
index 8f9179a..8543a15 100644
--- a/fight.php
+++ b/fight.php
@@ -189,7 +189,7 @@ function fight() { // One big long function that determines the outcome of the f
foreach($userspells as $a => $b) {
if ($b == $pickedspell) { $spell = true; }
}
- if ($pickedspell != true) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
+ if ($spell != true) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
if ($userrow["currentmp"] < $newspellrow["mp"]) { display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error"); die(); }
if ($newspellrow["type"] == 1) { // Heal spell.
diff --git a/lib.php b/lib.php
index 48816dd..676095a 100644
--- a/lib.php
+++ b/lib.php
@@ -2,7 +2,7 @@
$starttime = getmicrotime();
$numqueries = 0;
-$version = "1.1.5";
+$version = "1.1.6";
$build = "";
function opendb() { // Open database connection.
diff --git a/towns.php b/towns.php
index 3b3db53..8481e79 100644
--- a/towns.php
+++ b/towns.php
@@ -5,7 +5,7 @@ function inn() { // Staying at the inn resets all expendable stats to their max
global $userrow, $numqueries;
$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.
Get a life, loser."); }
+ if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.
Get a life, loser.", "Error"); }
$townrow = mysql_fetch_array($townquery);
if ($userrow["gold"] < $townrow["innprice"]) { display("You do not have enough gold to stay at this Inn tonight.
You may return to town, or use the direction buttons on the left to start exploring.", "Inn"); die(); }
@@ -41,7 +41,7 @@ function buy() { // Displays a list of available items for purchase.
global $userrow, $numqueries;
$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.
Get a life, loser."); }
+ if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.
Get a life, loser.", "Error"); }
$townrow = mysql_fetch_array($townquery);
$itemslist = explode(",",$townrow["itemslist"]);
@@ -79,6 +79,12 @@ function buy2($id) { // Confirm user's intent to purchase item.
global $userrow, $numqueries;
+ $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.
Get a life, loser.", "Error"); }
+ $townrow = mysql_fetch_array($townquery);
+ $townitems = explode(",",$townrow["itemslist"]);
+ if (! in_array($id, $townitems)) { display("Cheat attempt detected.
Get a life, loser.", "Error"); }
+
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
$itemsrow = mysql_fetch_array($itemsquery);
@@ -121,6 +127,12 @@ function buy3($id) { // Update user profile with new item & stats.
global $userrow;
+ $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.
Get a life, loser.", "Error"); }
+ $townrow = mysql_fetch_array($townquery);
+ $townitems = explode(",",$townrow["itemslist"]);
+ if (! in_array($id, $townitems)) { display("Cheat attempt detected.
Get a life, loser.", "Error"); }
+
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
$itemsrow = mysql_fetch_array($itemsquery);
@@ -343,7 +355,9 @@ function travelto($id, $usepoints=true) { // Send a user to a town from the Trav
if ($usepoints==true) {
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
display("You do not have enough TP to travel here. Please go back and try again when you get more TP.", "Travel To"); die();
- }
+ }
+ $mapped = explode(",",$userrow["towns"]);
+ if (!in_array($id, $mapped)) { display("Cheat attempt detected.
Get a life, loser.", "Error"); }
}
if (($userrow["latitude"] == $townrow["latitude"]) && ($userrow["longitude"] == $townrow["longitude"])) { display("You are already in this town. Click here to return to the main town screen.", "Travel To"); die(); }