Compare commits

...

5 Commits

22 changed files with 411 additions and 458 deletions

66
public/css/admin.css Normal file
View File

@ -0,0 +1,66 @@
:root {
--font-size: 12px;
}
html {
font-size: var(--font-size);
font-family: sans-serif;
}
div#admin-container {
max-width: 1280px;
margin: 0 auto;
padding: 1rem;
}
main {
display: flex;
gap: 2rem;
margin-bottom: 2rem;
}
main > nav {
flex: 0 0 auto;
}
main > section {
flex: 1;
}
table {
width: 100%;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
footer {
display: flex;
justify-content: space-around;
border: solid 1px black;
background-color: #eeeeee;
font-size: 0.8rem;
padding: 0.5rem;
}

View File

@ -4,7 +4,7 @@
html { html {
font-size: var(--font-size); font-size: var(--font-size);
font-family: Verdana, Geneva, Tahoma, sans-serif; font-family: sans-serif;
} }
body { body {
@ -99,7 +99,7 @@ a:hover {
} }
.small { .small {
font: 10px verdana; font-size: 0.8rem;
} }
.highlight { .highlight {
@ -116,7 +116,7 @@ a:hover {
font-weight: bold; font-weight: bold;
padding: 5px; padding: 5px;
font-size: 1.2rem; font-size: 1.2rem;
font-family: 'Times New Roman', Times, serif; font-family: serif;
} }
.copyright { .copyright {

73
public/css/help.css Normal file
View File

@ -0,0 +1,73 @@
:root {
--font-size: 14px;
}
html {
font-size: var(--font-size);
font-family: sans-serif;
}
body {
background-image: url('/img/background.jpg');
padding: 2rem;
}
table {
border-style: none;
padding: 0px;
}
tr:nth-child(even) {
background-color: white;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
footer {
display: flex;
justify-content: space-around;
font-size: 0.8rem;
padding: 0.5rem;
margin-top: 2rem;
}

View File

@ -84,7 +84,7 @@ function dotown()
if ($controlrow["shownews"] == 1) { if ($controlrow["shownews"] == 1) {
$newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC); $newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC);
$townrow["news"] = '<div class="title">Latest News</div>'; $townrow["news"] = '<div class="title">Latest News</div>';
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br>".nl2br($newsrow["content"]); $townrow["news"] .= "<span class=\"light\">[".pretty_date($newsrow["postdate"])."]</span><br>".nl2br($newsrow["content"]);
} }
// Who's Online. Currently just members. Guests maybe later. // Who's Online. Currently just members. Guests maybe later.
@ -114,7 +114,7 @@ function dotown()
HTML; HTML;
} }
return parsetemplate(gettemplate("towns"), $townrow); return render('towns', ['town' => $townrow]);
} }
/** /**
@ -138,14 +138,9 @@ function doexplore()
*/ */
function show_character_info(int $id = 0): void function show_character_info(int $id = 0): void
{ {
global $controlrow; global $controlrow, $userrow;
if ($id === 0) {
global $userrow;
} else {
$userrow = get_user_by_id($id);
}
$userrow = ($id === 0) ? $userrow : get_user_by_id($id);
if ($userrow === false) exit('Failed to show info for user ID '.$id); if ($userrow === false) exit('Failed to show info for user ID '.$id);
$levelrow = db()->query("SELECT `{$userrow["charclass"]}_exp` FROM levels WHERE id=? LIMIT 1;", [$userrow['level'] + 1])->fetchArray(SQLITE3_ASSOC); $levelrow = db()->query("SELECT `{$userrow["charclass"]}_exp` FROM levels WHERE id=? LIMIT 1;", [$userrow['level'] + 1])->fetchArray(SQLITE3_ASSOC);

View File

@ -26,7 +26,7 @@ function register_routes(Router $r): Router
$r->get('/admin/monsters', 'Admin\monsters'); $r->get('/admin/monsters', 'Admin\monsters');
$r->form('/admin/monsters/:id', 'Admin\editmonster'); $r->form('/admin/monsters/:id', 'Admin\editmonster');
$r->get('/admin/level', 'Admin\levels'); $r->form('/admin/level', 'Admin\levels');
$r->form('/admin/level/:id', 'Admin\editlevel'); $r->form('/admin/level/:id', 'Admin\editlevel');
$r->get('/admin/spells', 'Admin\spells'); $r->get('/admin/spells', 'Admin\spells');
@ -59,7 +59,7 @@ function donothing()
because mistakes in the database content may result in script errors or your game breaking completely. because mistakes in the database content may result in script errors or your game breaking completely.
HTML; HTML;
admindisplay($page, "Admin Home"); display_admin($page, "Admin Home");
} }
function primary() function primary()
@ -86,10 +86,10 @@ function primary()
$form['gamename'], $form['gamesize'], $form['class1name'], $form['class2name'], $form['class3name'], $form['gameopen'], $form['verifyemail'], $form['gameurl'], $form['adminemail'], $form['shownews'], $form['showonline'], $form['showbabble'] $form['gamename'], $form['gamesize'], $form['class1name'], $form['class2name'], $form['class3name'], $form['gameopen'], $form['verifyemail'], $form['gameurl'], $form['adminemail'], $form['shownews'], $form['showonline'], $form['showbabble']
]); ]);
admindisplay("Settings updated.", "Main Settings"); display_admin("Settings updated.", "Main Settings");
} else { } else {
$errorlist = ul_from_validate_errors($form['errors']); $errorlist = ul_from_validate_errors($form['errors']);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Main Settings"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Main Settings");
} }
} }
@ -128,7 +128,7 @@ function primary()
if ($controlrow["gameopen"] == 1) { $controlrow["open1select"] = "selected=\"selected\" "; } else { $controlrow["open1select"] = ""; } if ($controlrow["gameopen"] == 1) { $controlrow["open1select"] = "selected=\"selected\" "; } else { $controlrow["open1select"] = ""; }
if ($controlrow["gameopen"] == 0) { $controlrow["open0select"] = "selected=\"selected\" "; } else { $controlrow["open0select"] = ""; } if ($controlrow["gameopen"] == 0) { $controlrow["open0select"] = "selected=\"selected\" "; } else { $controlrow["open0select"] = ""; }
admindisplay(parsetemplate($page, $controlrow), "Main Settings"); display_admin(parse($page, $controlrow), "Main Settings");
} }
function items() function items()
@ -143,7 +143,7 @@ function items()
} }
if (!$hasItems) $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; if (!$hasItems) $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n";
admindisplay($page . "</table>", "Edit Items"); display_admin($page . "</table>", "Edit Items");
} }
function edititem($id) function edititem($id)
@ -163,10 +163,10 @@ function edititem($id)
db()->query('UPDATE items SET name=?, type=?, buycost=?, attribute=?, special=? WHERE id=?;', [ db()->query('UPDATE items SET name=?, type=?, buycost=?, attribute=?, special=? WHERE id=?;', [
$n, $_POST['type'] ?? 0, $bc, $a, $s, $id $n, $_POST['type'] ?? 0, $bc, $a, $s, $id
]); ]);
admindisplay("Item updated.","Edit Items"); display_admin("Item updated.","Edit Items");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Items"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Items");
} }
} }
@ -203,7 +203,7 @@ function edititem($id)
if ($item["type"] == 2) { $item["type2select"] = "selected=\"selected\" "; } else { $item["type2select"] = ""; } if ($item["type"] == 2) { $item["type2select"] = "selected=\"selected\" "; } else { $item["type2select"] = ""; }
if ($item["type"] == 3) { $item["type3select"] = "selected=\"selected\" "; } else { $item["type3select"] = ""; } if ($item["type"] == 3) { $item["type3select"] = "selected=\"selected\" "; } else { $item["type3select"] = ""; }
admindisplay(parsetemplate($page, $item), "Edit Items"); display_admin(parse($page, $item), "Edit Items");
} }
function drops() function drops()
@ -219,7 +219,7 @@ function drops()
if (!$has_drops) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No drops found.</td></tr>\n"; } if (!$has_drops) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No drops found.</td></tr>\n"; }
admindisplay($page . "</table>", "Edit Drops"); display_admin($page . "</table>", "Edit Drops");
} }
function editdrop($id) function editdrop($id)
@ -241,10 +241,10 @@ function editdrop($id)
db()->query('UPDATE drops SET name=?, mlevel=?, attribute1=?, attribute2=? WHERE id=?;', [ db()->query('UPDATE drops SET name=?, mlevel=?, attribute1=?, attribute2=? WHERE id=?;', [
$n, $ml, $a, $a2, $id $n, $ml, $a, $a2, $id
]); ]);
admindisplay("Item updated.","Edit Drops"); display_admin("Item updated.","Edit Drops");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Drops"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Drops");
} }
} }
@ -276,7 +276,7 @@ function editdrop($id)
defensepower - total defense power defensepower - total defense power
HTML; HTML;
admindisplay(parsetemplate($page, $drop), "Edit Drops"); display_admin(parse($page, $drop), "Edit Drops");
} }
function towns() function towns()
@ -292,7 +292,7 @@ function towns()
if (!$has_towns) $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; if (!$has_towns) $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n";
admindisplay($page . "</table>", "Edit Towns"); display_admin($page . "</table>", "Edit Towns");
} }
function edittown($id) function edittown($id)
@ -322,10 +322,10 @@ function edittown($id)
db()->query('UPDATE towns SET name=?, latitude=?, longitude=?, innprice=?, mapprice=?, travelpoints=?, itemslist=? WHERE id=?;', [ db()->query('UPDATE towns SET name=?, latitude=?, longitude=?, innprice=?, mapprice=?, travelpoints=?, itemslist=? WHERE id=?;', [
$n, $la, $lo, $ip, $mp, $tp, $il, $id $n, $la, $lo, $ip, $mp, $tp, $il, $id
]); ]);
admindisplay("Town updated.", "Edit Towns"); display_admin("Town updated.", "Edit Towns");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Towns"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Towns");
} }
} }
@ -348,7 +348,7 @@ function edittown($id)
</form> </form>
HTML; HTML;
admindisplay(parsetemplate($page, $row), "Edit Towns"); display_admin(parse($page, $row), "Edit Towns");
} }
function monsters() function monsters()
@ -376,7 +376,7 @@ function monsters()
if (!$has_monsters) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No monsters found.</td></tr>\n"; } if (!$has_monsters) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No monsters found.</td></tr>\n"; }
admindisplay($page."</table>", "Edit Monster"); display_admin($page."</table>", "Edit Monster");
} }
function editmonster($id) function editmonster($id)
@ -403,10 +403,10 @@ function editmonster($id)
db()->query('UPDATE monsters SET name=?, maxhp=?, maxdam=?, armor=?, level=?, maxexp=?, maxgold=?, immune=? WHERE id=?;', [ 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 $n, $mh, $md, $a, $l, $me, $mg, $_POST['immune'] ?? 0, $id
]); ]);
admindisplay("Monster updated.", "Edit monsters"); display_admin("Monster updated.", "Edit monsters");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit monsters"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit monsters");
} }
} }
@ -434,7 +434,7 @@ function editmonster($id)
if ($row["immune"] == 2) { $row["immune2select"] = "selected=\"selected\" "; } else { $row["immune2select"] = ""; } if ($row["immune"] == 2) { $row["immune2select"] = "selected=\"selected\" "; } else { $row["immune2select"] = ""; }
if ($row["immune"] == 3) { $row["immune3select"] = "selected=\"selected\" "; } else { $row["immune3select"] = ""; } if ($row["immune"] == 3) { $row["immune3select"] = "selected=\"selected\" "; } else { $row["immune3select"] = ""; }
admindisplay(parsetemplate($page, $row), "Edit Monsters"); display_admin(parse($page, $row), "Edit Monsters");
} }
function spells() function spells()
@ -451,7 +451,7 @@ function spells()
if (!$has_spells) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; } if (!$has_spells) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
admindisplay($page."</table>", "Edit Spells"); display_admin($page."</table>", "Edit Spells");
} }
function editspell($id) function editspell($id)
@ -470,10 +470,10 @@ function editspell($id)
db()->query('UPDATE spells SET name=?, mp=?, attribute=?, type=? WHERE id=?;', [ db()->query('UPDATE spells SET name=?, mp=?, attribute=?, type=? WHERE id=?;', [
$n, $mp, $a, $_POST['type'] ?? 0, $id $n, $mp, $a, $_POST['type'] ?? 0, $id
]); ]);
admindisplay("Spell updated.", "Edit Spells"); display_admin("Spell updated.", "Edit Spells");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells");
} }
} }
@ -499,7 +499,7 @@ function editspell($id)
if ($row["type"] == 4) { $row["type4select"] = "selected=\"selected\" "; } else { $row["type4select"] = ""; } if ($row["type"] == 4) { $row["type4select"] = "selected=\"selected\" "; } else { $row["type4select"] = ""; }
if ($row["type"] == 5) { $row["type5select"] = "selected=\"selected\" "; } else { $row["type5select"] = ""; } if ($row["type"] == 5) { $row["type5select"] = "selected=\"selected\" "; } else { $row["type5select"] = ""; }
admindisplay(parsetemplate($page, $row), "Edit Spells"); display_admin(parse($page, $row), "Edit Spells");
} }
function levels() function levels()
@ -522,12 +522,12 @@ function levels()
</form> </form>
HTML; HTML;
admindisplay($page, "Edit Levels"); display_admin($page, "Edit Levels");
} }
function editlevel() function editlevel()
{ {
if (!isset($_POST["level"])) admindisplay("No level to edit.", "Edit Levels"); if (!isset($_POST["level"])) display_admin("No level to edit.", "Edit Levels");
$id = $_POST["level"]; $id = $_POST["level"];
if (isset($_POST["submit"])) { if (isset($_POST["submit"])) {
@ -594,10 +594,10 @@ function editlevel()
$three_exp, $three_hp, $three_mp, $three_tp, $three_strength, $three_dexterity, $three_spells, $three_exp, $three_hp, $three_mp, $three_tp, $three_strength, $three_dexterity, $three_spells,
$id $id
]); ]);
admindisplay("Level updated.", "Edit Levels"); display_admin("Level updated.", "Edit Levels");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells");
} }
} }
@ -652,7 +652,7 @@ function editlevel()
</form> </form>
HTML; HTML;
admindisplay(parsetemplate($page, $row), "Edit Levels"); display_admin(parse($page, $row), "Edit Levels");
} }
function users() function users()
@ -669,7 +669,7 @@ function users()
if (!$has_users) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; } if (!$has_users) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
admindisplay($page."</table>", "Edit Users"); display_admin($page."</table>", "Edit Users");
} }
function edituser($id) function edituser($id)
@ -787,10 +787,10 @@ function edituser($id)
$slot3name, $dropcode, $spells, $towns, $id $slot3name, $dropcode, $spells, $towns, $id
]); ]);
admindisplay("User updated.", "Edit Users"); display_admin("User updated.", "Edit Users");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Users"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Users");
} }
} }
@ -883,7 +883,7 @@ function edituser($id)
if ($row["charclass"] == 2) { $row["class2select"] = "selected=\"selected\" "; } else { $row["class2select"] = ""; } if ($row["charclass"] == 2) { $row["class2select"] = "selected=\"selected\" "; } else { $row["class2select"] = ""; }
if ($row["charclass"] == 3) { $row["class3select"] = "selected=\"selected\" "; } else { $row["class3select"] = ""; } if ($row["charclass"] == 3) { $row["class3select"] = "selected=\"selected\" "; } else { $row["class3select"] = ""; }
admindisplay(parsetemplate($page, $row), "Edit Users"); display_admin(parse($page, $row), "Edit Users");
} }
function addnews() function addnews()
@ -898,10 +898,10 @@ function addnews()
if (count($errors) === 0) { if (count($errors) === 0) {
db()->query('INSERT INTO news (author, content) VALUES (?, ?);', [$userrow['username'], $c]); db()->query('INSERT INTO news (author, content) VALUES (?, ?);', [$userrow['username'], $c]);
admindisplay("News post added.", "Add News"); display_admin("News post added.", "Add News");
} else { } else {
$errorlist = implode('<br>', $errors); $errorlist = implode('<br>', $errors);
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Add News"); display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Add News");
} }
} }
@ -914,5 +914,5 @@ function addnews()
</form> </form>
HTML; HTML;
admindisplay($page, "Add News"); display_admin($page, "Add News");
} }

View File

@ -200,7 +200,7 @@ function fight()
} }
// Finalize page and display it // Finalize page and display it
display(parsetemplate(gettemplate("fight"), $pagearray), "Fighting"); display(render('fight', ['page' => $pagearray]), "Fighting");
} }
function victory() function victory()

View File

@ -44,7 +44,7 @@ function showthread($id, $start)
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"/forum\">Forum</a> :: ".$title['title']."</b></td></tr>\n"; $page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"/forum\">Forum</a> :: ".$title['title']."</b></td></tr>\n";
while ($row = $posts->fetchArray(SQLITE3_ASSOC)) { while ($row = $posts->fetchArray(SQLITE3_ASSOC)) {
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br><br>".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n"; $page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br><br>".pretty_date($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
} }
$page .= "</table></td></tr></table><br>"; $page .= "</table></td></tr></table><br>";
$page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br><form action=\"/forum/reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$title["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>"; $page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br><form action=\"/forum/reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$title["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";

View File

@ -246,7 +246,7 @@ function main()
[ <a href="#top">Top</a> ] [ <a href="#top">Top</a> ]
HTML; HTML;
display_help(parsetemplate($page, $controlrow)); display_help(parse($page, $controlrow));
} }
function items() function items()
@ -489,12 +489,16 @@ function levels()
Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level. Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level.
HTML; HTML;
display_help(parsetemplate($page, $controlrow)); display_help(parse($page, $controlrow));
} }
function display_help(string $content) function display_help(string $content)
{ {
global $controlrow; global $controlrow;
$template = parsetemplate(gettemplate('help'), $controlrow); echo render('help', [
echo parsetemplate($template, ['content' => $content]); 'control' => $controlrow,
'content' => $content,
'version' => VERSION,
'build' => BUILD
]);
} }

View File

@ -49,9 +49,7 @@ function login()
redirect('/'); redirect('/');
} }
$page = gettemplate("login"); display(render('login'), 'Log In', true, false, false);
$title = "Log In";
display($page, $title, false, false, false, false);
} }
/** /**
@ -111,7 +109,7 @@ function register()
$page = render('register', ['controlrow' => $controlrow]); $page = render('register', ['controlrow' => $controlrow]);
} }
display($page, "Register", false, false, false); display($page, 'Register', true, false, false);
} }
function verify() function verify()
@ -129,8 +127,7 @@ function verify()
display("Your account was verified successfully.<br><br>You may now continue to the <a href=\"/login\">Login Page</a> and start playing the game.<br><br>Thanks for playing!","Verify Email",false,false,false); display("Your account was verified successfully.<br><br>You may now continue to the <a href=\"/login\">Login Page</a> and start playing the game.<br><br>Thanks for playing!","Verify Email",false,false,false);
} }
$topnav = "<a href=\"/login\"><img src=\"/img/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"/img/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"/help\"><img src=\"/img/button_help.gif\" alt=\"Help\" border=\"0\" /></a>"; display(render('verify'), "Verify Email", true, false, false);
display(gettemplate("verify"), "Verify Email", false, false, false);
} }
function lostpassword() function lostpassword()
@ -152,9 +149,7 @@ function lostpassword()
} }
} }
$topnav = "<a href=\"/login\"><img src=\"/img/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"/img/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"/help\"><img src=\"/img/button_help.gif\" alt=\"Help\" border=\"0\" /></a>"; display(render('lostpassword'), "Lost Password", true, false, false);
display(gettemplate("lostpassword"), "Lost Password", false, false, false);
} }
function changepassword() function changepassword()
@ -187,8 +182,7 @@ function changepassword()
display("Your password was changed successfully.<br><br>You have been logged out of the game to avoid errors.<br><br>Please <a href=\"/login\">log back in</a> to continue playing.","Change Password",false,false,false); display("Your password was changed successfully.<br><br>You have been logged out of the game to avoid errors.<br><br>Please <a href=\"/login\">log back in</a> to continue playing.","Change Password",false,false,false);
} }
$topnav = "<a href=\"/login\"><img src=\"/img/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"/img/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"/help\"><img src=\"/img/button_help.gif\" alt=\"Help\" border=\"0\" /></a>"; display(render('changepassword'), "Change Password", true, false, false);
display(gettemplate("changepassword"), "Change Password", false, false, false);
} }
function sendpassemail($emailaddress, $password) function sendpassemail($emailaddress, $password)

View File

@ -5,7 +5,7 @@ require_once __DIR__ . '/database.php';
define('VERSION', '1.2.5'); define('VERSION', '1.2.5');
define('BUILD', 'Reawaken'); define('BUILD', 'Reawaken');
define('START', microtime(true)); define('START', microtime(true));
define('DEBUG', true); define('DEBUG', false);
/** /**
* Open or get SQLite database connection. * Open or get SQLite database connection.
@ -44,46 +44,30 @@ function render(string $path_to_base_view, array $data = []): string|false
return ob_get_clean(); return ob_get_clean();
} }
function gettemplate($templatename) { // SQL query for the template. /**
* Replace tags with given content.
$filename = __DIR__ . "/../templates/" . $templatename . ".php"; */
include("$filename"); function parse(string $template, array $array): string
return $template; {
return strtr($template, array_combine(
array_map(fn($key) => "{{{$key}}}", array_keys($array)),
array_values($array)
));
} }
function parsetemplate($template, $array) { // Replace template with proper content. /**
* Change the SQLite3 datetime format (YYYY-MM-DD HH:MM:SS) into something friendlier.
foreach($array as $a => $b) { */
$template = str_replace("{{{$a}}}", $b, $template); function pretty_date(string $uglydate): string
} {
return $template; return date("l, F j, Y", mktime(
0,
} 0,
0,
function getmicrotime() { // Used for timing script operations. substr($uglydate, 5, 2), // Month
substr($uglydate, 8, 2), // Day
list($usec, $sec) = explode(" ",microtime()); substr($uglydate, 0, 4) // Year
return ((float)$usec + (float)$sec); ));
}
function prettydate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
}
function prettyforumdate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
}
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));
} }
/** /**
@ -95,42 +79,31 @@ function make_safe(string $content): string
} }
/** /**
* Finalize page and output to browser. * Finalize admin page and output to browser.
*/ */
function admindisplay($content, $title) function display_admin($content, $title)
{ {
global $userrow, $controlrow; echo render('admin', [
if (!isset($controlrow)) {
$query = db()->query('SELECT * FROM control WHERE id=1 LIMIT 1;');
$controlrow = $query->fetchArray(SQLITE3_ASSOC);
}
$page = parsetemplate(gettemplate("admin"), [
"title" => $title, "title" => $title,
"content" => $content, "content" => $content,
"totaltime" => round(getmicrotime() - START, 4), "totaltime" => round(microtime(true) - START, 4),
"numqueries" => db()->count, "numqueries" => db()->count,
"version" => VERSION, "version" => VERSION,
"build" => BUILD "build" => BUILD
]); ]);
echo "<html>\n" . $page;
exit; exit;
} }
function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, $badstart=false) { // Finalize page and output to browser. /**
* Finalize page and output to browser.
*/
function display($content, $title, bool $topnav = true, bool $leftnav = true, bool $rightnav = true): void
{
global $userrow, $controlrow; global $userrow, $controlrow;
if (!isset($controlrow)) {
$query = db()->query('SELECT * FROM control WHERE id=1 LIMIT 1;');
$controlrow = $query->fetchArray(SQLITE3_ASSOC);
}
if ($badstart == false) { global $starttime; } else { $starttime = $badstart; }
if ($rightnav == true) { $rightnav = gettemplate("rightnav"); } else { $rightnav = ""; }
if ($leftnav == true) { $leftnav = gettemplate("leftnav"); } else { $leftnav = ""; }
if ($topnav == true) { if ($topnav == true) {
if ($userrow !== false) { // user should be logged in
$topnav = <<<HTML $topnav = <<<HTML
<a href='/logout'><img src='/img/button_logout.gif' alt='Log Out' title='Log Out'></a> <a href='/logout'><img src='/img/button_logout.gif' alt='Log Out' title='Log Out'></a>
<a href='/help'><img src='/img/button_help.gif' alt='Help' title='Help'></a> <a href='/help'><img src='/img/button_help.gif' alt='Help' title='Help'></a>
@ -142,6 +115,9 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
<a href='/help'><img src='/img/button_help.gif' alt='Help' title='Help'></a> <a href='/help'><img src='/img/button_help.gif' alt='Help' title='Help'></a>
HTML; HTML;
} }
} else {
$topnav = '';
}
if (isset($userrow) && $userrow !== false) { if (isset($userrow) && $userrow !== false) {
@ -226,21 +202,20 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
$userrow = []; $userrow = [];
} }
$page = parsetemplate(gettemplate("primary"), [ echo render('primary', [
"dkgamename" => $controlrow["gamename"], "dkgamename" => $controlrow["gamename"],
"title" => $title, "title" => $title,
"content" => $content, "content" => $content,
"rightnav" => parsetemplate($rightnav, $userrow), 'rightnav' => $rightnav ? render('rightnav', ['user' => $userrow]) : '',
"leftnav" => parsetemplate($leftnav, $userrow), "leftnav" => $leftnav ? render('leftnav', ['user' => $userrow]) : '',
"topnav" => $topnav, "topnav" => $topnav,
"totaltime" => round(getmicrotime() - START, 4), "totaltime" => round(microtime(true) - START, 4),
"numqueries" => db()->count, "numqueries" => db()->count,
"version" => VERSION, "version" => VERSION,
"build" => BUILD, "build" => BUILD,
"querylog" => DEBUG ? '<pre>'.print_r(db()->log, true).'</pre>' : '' "querylog" => DEBUG ? db()->log : []
]); ]);
echo "<html>\n" . $page;
exit; exit;
} }

View File

@ -1,77 +1,46 @@
<?php <!DOCTYPE html>
$template = <<<HTML <html lang="en">
<head> <head>
<title>{{title}}</title> <meta charset="UTF-8">
<style type="text/css"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
body { <title><?= $title ?></title>
color: black; <link rel="stylesheet" href="/css/admin.css">
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head> </head>
<body><center> <body>
<table width="90%"><tr> <div id="admin-container">
<td width="150" style="border-right: solid 1px black;"> <main>
<b><u>DK Administration</u></b><br><br> <nav>
<h1>Admin Panel</h1>
<b>Links:</b><br> <b>Links:</b><br>
<a href="/admina">Admin Home</a><br> <a href="/admin">Admin Home</a><br>
<a href="/">Game Home</a><br><br> <a href="/">Game Home</a><br><br>
<b>Primary Data:</b><br> <b>Primary Data:</b><br>
<a href="/admin/main">Main Settings</a><br> <a href="/admin/main">Main Settings</a><br>
<a href="/admin/news">Add News Post</a><br> <a href="/admin/news">Add News Post</a><br>
<a href="/admin/users">Edit Users</a><br><br> <a href="/admin/users">Edit Users</a><br><br>
<b>Game Data:</b><br> <b>Game Data:</b><br>
<a href="/admin/items">Edit Items</a><br> <a href="/admin/items">Edit Items</a><br>
<a href="/admin/drops">Edit Drops</a><br> <a href="/admin/drops">Edit Drops</a><br>
<a href="/admin/towns">Edit Towns</a><br> <a href="/admin/towns">Edit Towns</a><br>
<a href="/admin/monsters">Edit Monsters</a><br> <a href="/admin/monsters">Edit Monsters</a><br>
<a href="/admin/levels">Edit Levels</a><br> <a href="/admin/level">Edit Levels</a><br>
<a href="/admin/spells">Edit Spells</a><br> <a href="/admin/spells">Edit Spells</a><br>
</td><td> </nav>
{{content}}
</td></tr></table> <section>
<br> <?= $content ?>
<table class="copyright" width="90%"><tr> </section>
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">&copy; 2003-2006 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}} {{build}}</td> </main>
</center></body>
<footer>
<div>Powered by <a href="/" target="_new">Dragon Knight</a></div>
<div>&copy; 2024 Sharkk</div>
<div><?= $totaltime ?> Seconds, <?= $numqueries ?> Queries</div>
<div>Version <?= $version ?> <?= $build ?></div>
</footer>
</div>
</body>
</html> </html>
HTML;

View File

@ -1,14 +1,10 @@
<?php <form action="/changepassword" method="post">
$template = <<<THEVERYENDOFYOU
<form action="users.php?do=changepassword" method="post">
<table width="100%"> <table width="100%">
<tr><td colspan="2">Use the form below to change your password. All fields are required. New passwords must be 10 alphanumeric characters or less.</td></tr> <tr><td colspan="2">Use the form below to change your password. All fields are required. New passwords must be 10 alphanumeric characters or less.</td></tr>
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr> <tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr>
<tr><td>Old Password:</td><td><input type="password" name="password" /></td></tr> <tr><td>Old Password:</td><td><input type="password" name="password" /></td></tr>
<tr><td>New Password:</td><td><input type="password" name="new_password" /></td></tr> <tr><td>New Password:</td><td><input type="password" name="new_password" /></td></tr>
<tr><td>Verify New Password:</td><td><input type="password" name="new_password2" /><br><br><br></td></tr> <tr><td>Verify New Password:</td><td><input type="password" name="new_password2" /><br><br><br></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr> <tr><td colspan="2"><input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"></td></tr>
</table> </table>
</form> </form>
THEVERYENDOFYOU;
?>

View File

@ -1,14 +1,10 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%"> <table width="100%">
<tr><td class="title"><img src="/img/title_fighting.gif" alt="Fighting" /></td></tr> <tr><td class="title"><img src="/img/title_fighting.gif" alt="Fighting" /></td></tr>
<tr><td> <tr><td>
You are fighting a <b>{{monstername}}</b><br><br> You are fighting a <b><?= $page['monstername'] ?></b><br><br>
{{monsterhp}} <?= $page['monsterhp'] ?>
{{yourturn}} <?= $page['yourturn'] ?>
{{monsterturn}} <?= $page['monsterturn'] ?>
{{command}} <?= $page['command'] ?>
</td></tr> </td></tr>
</table> </table>
THEVERYENDOFYOU;
?>

View File

@ -1,85 +1,27 @@
<?php
$template = <<<HTML
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>{{gamename}} Help</title> <meta charset="UTF-8">
<style type="text/css"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
body { <title><?= $control['gamename'] ?> Help</title>
background-image: url('/img/background.jpg'); <link rel="stylesheet" href="/css/help.css">
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
tr:nth-child(even) {
background-color: white;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head> </head>
<body> <body>
<a name="top"></a> <a name="top"></a>
<h1>{{gamename}} Help</h1> <h1><?= $control['gamename'] ?> Help</h1>
[ <a href="/">Return to the game</a> ] [ <a href="/help">Back to Help</a> ]<br>
[ <a href="/">Return to Game</a> ]
<br><br><hr> <br><br><hr>
{{content}} <?= $content ?>
<br><br> <br><br>
<table class="copyright" width="100%"><tr> <footer>
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">&copy; 2003-2006 by renderse7en</td> <div>Powered by <a href="/" target="_new">Dragon Knight</a></div>
</tr></table> <div>&copy; 2024 Sharkk</div>
<div>Version <?= $version ?> <?= $build ?></div>
</footer>
</body> </body>
</html> </html>
HTML;

View File

@ -1,10 +1,8 @@
<?php
$template = <<<HTML
<section> <section>
<div class="title"><img src="/img/button_location.gif" alt="Location" title="Location"></div> <div class="title"><img src="/img/button_location.gif" alt="Location" title="Location"></div>
Currently: {{currentaction}}<br> Currently: <?= $user['currentaction'] ?><br>
Latitude: {{latitude}}<br> Latitude: <?= $user['latitude'] ?><br>
Longitude: {{longitude}}<br> Longitude: <?= $user['longitude'] ?><br>
<a href="javascript:openmappopup()">View Map</a><br> <a href="javascript:openmappopup()">View Map</a><br>
<form action="/move" method="post" class="move-compass"> <form action="/move" method="post" class="move-compass">
<button type="submit" name="direction" value="north" class="north">North</button> <button type="submit" name="direction" value="north" class="north">North</button>
@ -18,18 +16,17 @@ $template = <<<HTML
<section> <section>
<div class="title"><img src="/img/button_towns.gif" alt="Towns" title="Towns"></div> <div class="title"><img src="/img/button_towns.gif" alt="Towns" title="Towns"></div>
{{currenttown}} <?= $user['currenttown'] ?>
Travel To:<br> Travel To:<br>
{{townslist}} <?= $user['townslist'] ?>
</section> </section>
<section> <section>
<div class="title"><img src="/img/button_functions.gif" alt="Functions" title="Functions"></div> <div class="title"><img src="/img/button_functions.gif" alt="Functions" title="Functions"></div>
<a href="/">Home</a><br> <a href="/">Home</a><br>
{{forumslink}} <?= $user['forumslink'] ?>
{{adminlink}} <?= $user['adminlink'] ?>
<a href="/changepassword">Change Password</a><br> <a href="/changepassword">Change Password</a><br>
<a href="/logout">Log Out</a><br> <a href="/logout">Log Out</a><br>
<a href="/help">Help</a> <a href="/help">Help</a>
</section> </section>
HTML;

View File

@ -1,6 +1,3 @@
<?php
$template = <<<HTML
<form action="/login" method="post"> <form action="/login" method="post">
<table width="75%"> <table width="75%">
<tr> <tr>
@ -32,4 +29,3 @@ $template = <<<HTML
</tr> </tr>
</table> </table>
</form> </form>
HTML;

View File

@ -1,11 +1,7 @@
<?php <form action="/lostpassword" method="post">
$template = <<<THEVERYENDOFYOU
<form action="users.php?do=lostpassword" method="post">
<table width="80%"> <table width="80%">
<tr><td colspan="2">If you've lost your password, enter your email address below and you will be sent a new one.</td></tr> <tr><td colspan="2">If you've lost your password, enter your email address below and you will be sent a new one.</td></tr>
<tr><td width="20%">Email Address:</td><td><input type="text" name="email" size="30" maxlength="100" /></td></tr> <tr><td width="20%">Email Address:</td><td><input type="text" name="email"></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr> <tr><td colspan="2"><input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"></td></tr>
</table> </table>
</form> </form>
THEVERYENDOFYOU;
?>

View File

@ -1,39 +0,0 @@
<?php
$template = <<<HTML
Here is the character profile for <b>{{username}}</b>.<br><br>
When you're finished, you may <a href="/">return to town</a>.<br><br>
<table width="200">
<tr><td class="title"><img src="/img/button_character.gif" alt="Character" title="Character" /></td></tr>
<tr><td>
<b>{{username}}</b><br><br>
Class: {{charclass}}<br><br>
Level: {{level}}<br>
Experience: {{experience}}<br>
Gold: {{gold}}<br>
Hit Points: {{currenthp}} / {{maxhp}}<br>
Magic Points: {{currentmp}} / {{maxmp}}<br>
Travel Points: {{currenttp}} / {{maxtp}}<br><br>
Strength: {{strength}}<br>
Dexterity: {{dexterity}}<br>
Attack Power: {{attackpower}}<br>
Defense Power: {{defensepower}}<br>
</td></tr>
</table><br>
<table width="200">
<tr><td class="title"><img src="/img/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
<tr><td>
<table width="100%">
<tr><td><img src="/img/icon_weapon.gif" alt="Weapon" title="Weapon" /></td><td width="100%">Weapon: {{weaponname}}</td></tr>
<tr><td><img src="/img/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
<tr><td><img src="/img/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
</table>
Slot 1: {{slot1name}}<br>
Slot 2: {{slot2name}}<br>
Slot 3: {{slot3name}}
</td></tr>
</table><br>
HTML;

View File

@ -1,11 +1,9 @@
<?php
$template = <<<HTML
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}}</title> <title><?= $title ?></title>
<link rel="stylesheet" href="/css/dk.css"> <link rel="stylesheet" href="/css/dk.css">
<script> <script>
@ -24,25 +22,30 @@ $template = <<<HTML
<body> <body>
<div id="game-container"> <div id="game-container">
<header> <header>
<img id="logo" src="/img/logo.gif" alt="{{dkgamename}}" title="{{dkgamename}}"> <img id="logo" src="/img/logo.gif" alt="<?= $dkgamename ?>" title="<?= $dkgamename ?>">
<nav>{{topnav}}</nav> <nav><?= $topnav ?></nav>
</header> </header>
<main> <main>
<section id="left">{{leftnav}}</section> <section id="left"><?= $leftnav ?></section>
<section id="middle">{{content}}</section> <section id="middle"><?= $content ?></section>
<section id="right">{{rightnav}}</section> <section id="right"><?= $rightnav ?></section>
</main> </main>
<footer> <footer>
<div>Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></div> <div>Powered by <a href="/" target="_new">Dragon Knight</a></div>
<div>&copy; 2024 Sharkk</div> <div>&copy; 2024 Sharkk</div>
<div>{{totaltime}} Seconds, {{numqueries}} Queries</div> <div><?= $totaltime ?> Seconds, <?= $numqueries ?> Queries</div>
<div>Version {{version}} {{build}}</div> <div>Version <?= $version ?> <?= $build ?></div>
</footer> </footer>
{{querylog}} <?php
if (!empty($querylog)) {
echo '<pre>';
foreach ($querylog as $record) echo '<div>['.round($record[1], 2)."s] {$record[0]}</div>";
echo '</pre>';
}
?>
</div> </div>
</body> </body>
</html> </html>
HTML;

View File

@ -1,30 +1,27 @@
<?php
$template = <<<HTML
<section> <section>
<div class="title"><img src="/img/button_character.gif" alt="Character" title="Character"></div> <div class="title"><img src="/img/button_character.gif" alt="Character" title="Character"></div>
<b>{{username}}</b><br> <b><?= $user['username'] ?></b><br>
Level: {{level}}<br> Level: <?= $user['level'] ?><br>
Exp: {{experience}}<br> Exp: <?= $user['experience'] ?><br>
Gold: {{gold}}<br> Gold: <?= $user['gold'] ?><br>
HP: {{currenthp}}<br> HP: <?= $user['currenthp'] ?><br>
MP: {{currentmp}}<br> MP: <?= $user['currentmp'] ?><br>
TP: {{currenttp}}<br> TP: <?= $user['currenttp'] ?><br>
{{statbars}}<br> <?= $user['statbars'] ?><br>
<a href="javascript:opencharpopup()">Extended Stats</a> <a href="javascript:opencharpopup()">Extended Stats</a>
</section> </section>
<section> <section>
<div class="title"><img src="/img/button_inventory.gif" alt="Inventory" title="Inventory"></div> <div class="title"><img src="/img/button_inventory.gif" alt="Inventory" title="Inventory"></div>
<img src="/img/icon_weapon.gif" alt="Weapon" title="Weapon"> Weapon: {{weaponname}}<br> <img src="/img/icon_weapon.gif" alt="Weapon" title="Weapon"> Weapon: <?= $user['weaponname'] ?><br>
<img src="/img/icon_armor.gif" alt="Armor" title="Armor"> Armor: {{armorname}}<br> <img src="/img/icon_armor.gif" alt="Armor" title="Armor"> Armor: <?= $user['armorname'] ?><br>
<img src="/img/icon_shield.gif" alt="Shield" title="Shield"> Shield: {{shieldname}}<br> <img src="/img/icon_shield.gif" alt="Shield" title="Shield"> Shield: <?= $user['shieldname'] ?><br>
Slot 1: {{slot1name}}<br> Slot 1: <?= $user['slot1name'] ?><br>
Slot 2: {{slot2name}}<br> Slot 2: <?= $user['slot2name'] ?><br>
Slot 3: {{slot3name}} Slot 3: <?= $user['slot3name'] ?>
</section> </section>
<section> <section>
<div class="title"><img src="/img/button_fastspells.gif" alt="Fast Spells" title="Fast Spells"></div> <div class="title"><img src="/img/button_fastspells.gif" alt="Fast Spells" title="Fast Spells"></div>
{{magiclist}} <?= $user['magiclist'] ?>
</section> </section>
HTML;

View File

@ -1,8 +1,6 @@
<?php
$template = <<<HTML
<div class="town-content"> <div class="town-content">
<div class="options"> <div class="options">
<div class="title"><img src="/img/town_{{id}}.gif" alt="Welcome to {{name}}" title="Welcome to {{name}}"></div> <div class="title"><img src="/img/town_<?= $town['id'] ?>.gif" alt="Welcome to <?= $town['name'] ?>" title="Welcome to <?= $town['name'] ?>"></div>
<b>Town Options:</b><br> <b>Town Options:</b><br>
<ul> <ul>
<li><a href="/inn">Rest at the Inn</a></li> <li><a href="/inn">Rest at the Inn</a></li>
@ -12,15 +10,14 @@ $template = <<<HTML
</div> </div>
<div class="news"> <div class="news">
{{news}} <?= $town['news'] ?>
</div> </div>
<div class="whos-online"> <div class="whos-online">
{{whosonline}} <?= $town['whosonline'] ?>
</div> </div>
<div class="babblebox"> <div class="babblebox">
{{babblebox}} <?= $town['babblebox'] ?>
</div> </div>
</div> </div>
HTML;

View File

@ -1,14 +1,10 @@
<?php <form action="/verify" method="post">
$template = <<<HTML
<form action="users.php?do=verify" method="post">
<table width="80%"> <table width="80%">
<tr><td colspan="2">Thank you for registering a character. Please enter your username, email address, and the verification code <tr><td colspan="2">Thank you for registering a character. Please enter your username, email address, and the verification code
that was emailed to you to unlock your character.</td></tr> that was emailed to you to unlock your character.</td></tr>
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr> <tr><td width="20%">Username:</td><td><input type="text" name="username"></td></tr>
<tr><td>Email Address:</td><td><input type="text" name="email" size="30" maxlength="100" /></td></tr> <tr><td>Email Address:</td><td><input type="text" name="email"></td></tr>
<tr><td>Verification Code:</td><td><input type="text" name="token" /><br><br><br></td></tr> <tr><td>Verification Code:</td><td><input type="text" name="token"><br><br><br></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr> <tr><td colspan="2"><input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"></td></tr>
</table> </table>
</form> </form>
HTML;