Skip to content

Commit

Permalink
v1.1.3
Browse files Browse the repository at this point in the history
### 1.1.3 (5.20.2004) ###
- Fixed several bugs related small bugs related to new version info
location.
- Moved checkcookies() out of login.php, into cookies.php.
- Deleted admin/lib.php, moved requisite functions into standard
lib.php.
- Fixed minor display bug in admin template.
  • Loading branch information
renderse7en committed Feb 5, 2017
1 parent a70f7ed commit 449297a
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 218 deletions.
75 changes: 38 additions & 37 deletions admin/admin.php
@@ -1,6 +1,7 @@
<?php // admin.php :: primary administration script.

include('lib.php');
include('../lib.php');
include('../cookies.php');
$link = opendb();
$userrow = checkcookies();
if ($userrow == false) { die("Please log in to the <a href=\"../login.php?do=login\">game</a> before using the control panel."); }
Expand Down Expand Up @@ -33,7 +34,7 @@
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.<br /><br />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 <a href=\"http://www.phpmyadmin.net\" target=\"_new\">phpMyAdmin</a>. Also, you may want to have a copy of the Dragon Knight development kit, available from the <a href=\"http://dragon.se7enet.com/dev.php\">Dragon Knight homepage</a>.<br /><br />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");
admindisplay($page, "Admin Home");

}

Expand All @@ -58,9 +59,9 @@ function main() {

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");
admindisplay("Settings updated.","Main Settings");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Main Settings");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Main Settings");
}
}

Expand Down Expand Up @@ -113,7 +114,7 @@ function main() {
if ($controlrow["gameopen"] == 0) { $controlrow["open0select"] = "selected=\"selected\" "; } else { $controlrow["open0select"] = ""; }

$page = parsetemplate($page, $controlrow);
display($page, "Main Settings");
admindisplay($page, "Main Settings");

}

Expand All @@ -128,7 +129,7 @@ function items() {
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Items");
admindisplay($page, "Edit Items");

}

Expand All @@ -148,9 +149,9 @@ function edititem($id) {

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");
admindisplay("Item updated.","Edit Items");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Items");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Items");
}

}
Expand Down Expand Up @@ -191,7 +192,7 @@ function edititem($id) {
if ($row["type"] == 3) { $row["type3select"] = "selected=\"selected\" "; } else { $row["type3select"] = ""; }

$page = parsetemplate($page, $row);
display($page, "Edit Items");
admindisplay($page, "Edit Items");

}

Expand All @@ -206,7 +207,7 @@ function drops() {
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Drops");
admindisplay($page, "Edit Drops");

}

Expand All @@ -225,9 +226,9 @@ function editdrop($id) {

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");
admindisplay("Item updated.","Edit Drops");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Drops");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Drops");
}

}
Expand Down Expand Up @@ -263,7 +264,7 @@ function editdrop($id) {
END;

$page = parsetemplate($page, $row);
display($page, "Edit Drops");
admindisplay($page, "Edit Drops");

}

Expand All @@ -278,7 +279,7 @@ function towns() {
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Towns");
admindisplay($page, "Edit Towns");

}

Expand All @@ -305,9 +306,9 @@ function edittown($id) {

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");
admindisplay("Town updated.","Edit Towns");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Towns");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Towns");
}

}
Expand All @@ -334,7 +335,7 @@ function edittown($id) {
END;

$page = parsetemplate($page, $row);
display($page, "Edit Towns");
admindisplay($page, "Edit Towns");

}

Expand All @@ -360,7 +361,7 @@ function monsters() {
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Monster");
admindisplay($page, "Edit Monster");

}

Expand All @@ -387,9 +388,9 @@ function editmonster($id) {

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");
admindisplay("Monster updated.","Edit monsters");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit monsters");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit monsters");
}

}
Expand Down Expand Up @@ -421,7 +422,7 @@ function editmonster($id) {
if ($row["immune"] == 3) { $row["immune3select"] = "selected=\"selected\" "; } else { $row["immune3select"] = ""; }

$page = parsetemplate($page, $row);
display($page, "Edit Monsters");
admindisplay($page, "Edit Monsters");

}

Expand All @@ -436,7 +437,7 @@ function spells() {
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Spells");
admindisplay($page, "Edit Spells");

}

Expand All @@ -455,9 +456,9 @@ function editspell($id) {

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");
admindisplay("Spell updated.","Edit Spells");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Spells");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Spells");
}

}
Expand Down Expand Up @@ -487,7 +488,7 @@ function editspell($id) {
if ($row["type"] == 5) { $row["type5select"] = "selected=\"selected\" "; } else { $row["type5select"] = ""; }

$page = parsetemplate($page, $row);
display($page, "Edit Spells");
admindisplay($page, "Edit Spells");

}

Expand All @@ -511,13 +512,13 @@ function levels() {
</form>
END;

display($page, "Edit Levels");
admindisplay($page, "Edit Levels");

}

function editlevel() {

if (!isset($_POST["level"])) { display("No level to edit.", "Edit Levels"); die(); }
if (!isset($_POST["level"])) { admindisplay("No level to edit.", "Edit Levels"); die(); }
$id = $_POST["level"];

if (isset($_POST["submit"])) {
Expand Down Expand Up @@ -579,9 +580,9 @@ function editlevel() {
WHERE id='$id' LIMIT 1
END;
$query = doquery($updatequery, "levels");
display("Level updated.","Edit Levels");
admindisplay("Level updated.","Edit Levels");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Spells");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Spells");
}

}
Expand Down Expand Up @@ -637,7 +638,7 @@ function editlevel() {
END;

$page = parsetemplate($page, $row);
display($page, "Edit Levels");
admindisplay($page, "Edit Levels");

}

Expand All @@ -652,7 +653,7 @@ function users() {
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Users");
admindisplay($page, "Edit Users");

}

Expand Down Expand Up @@ -767,9 +768,9 @@ function edituser($id) {
towns="$towns" WHERE id="$id" LIMIT 1
END;
$query = doquery($updatequery, "users");
display("User updated.","Edit Users");
admindisplay("User updated.","Edit Users");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Users");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Users");
}

}
Expand Down Expand Up @@ -873,7 +874,7 @@ function edituser($id) {
if ($row["difficulty"] == 3) { $row["diff3select"] = "selected=\"selected\" "; } else { $row["diff3select"] = ""; }

$page = parsetemplate($page, $row);
display($page, "Edit Users");
admindisplay($page, "Edit Users");

}

Expand All @@ -888,9 +889,9 @@ function addnews() {

if ($errors == 0) {
$query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),content='$content'", "news");
display("News post added.","Add News");
admindisplay("News post added.","Add News");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Add News");
admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Add News");
}

}
Expand All @@ -904,7 +905,7 @@ function addnews() {
</form>
END;

display($page, "Add News");
admindisplay($page, "Add News");

}

Expand Down

0 comments on commit 449297a

Please sign in to comment.