<?php include 'lib.php'; $link = opendb(); $controlrow = getcontrol(); ob_start("ob_gzhandler"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title><?php echo $controlrow["gamename"]; ?> Help</title> <style type="text/css"> body { background-image: url(images/background.jpg); color: black; font: 11px verdana; } table { border-style: none; padding: 0px; font: 11px verdana; } td { border-style: none; padding: 3px; vertical-align: top; }
function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi. $controlrow = getcontrol(); $from = trim($from); if (!$from) { $from = '<' . $controlrow["adminemail"] . '>'; } $rp = $controlrow["adminemail"]; $org = $controlrow["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 display($content, $title, $topnav = true, $leftnav = true, $rightnav = true, $badstart = false) { // Finalize page and output to browser. global $numqueries, $userrow, $controlrow, $version, $build; if (!isset($controlrow)) { $controlrow = getcontrol(); } if ($badstart == false) { global $starttime; } else { $starttime = $badstart; } $template = gettemplate("primary"); if ($rightnav == true) { $rightnav = gettemplate("rightnav"); } else { $rightnav = ""; } if ($leftnav == true) { $leftnav = gettemplate("leftnav"); } else { $leftnav = ""; } if ($topnav == true) { $topnav = "<a href=\"login.php?do=logout\"><img src=\"images/button_logout.gif\" alt=\"Log Out\" title=\"Log Out\" border=\"0\" /></a> <a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" title=\"Help\" border=\"0\" /></a>"; } else { $topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" title=\"Log In\" border=\"0\" /></a> <a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" title=\"Register\" border=\"0\" /></a> <a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" title=\"Help\" border=\"0\" /></a>"; } if (isset($userrow)) { // Get userrow again, in case something has been updated. $userquery = doquery("SELECT * FROM {{table}} WHERE id='" . $userrow["id"] . "' LIMIT 1", "users"); unset($userrow); $userrow = mysql_fetch_array($userquery); // Current town name. if ($userrow["currentaction"] == "In Town") { $townquery = doquery("SELECT * FROM {{table}} WHERE latitude='" . $userrow["latitude"] . "' AND longitude='" . $userrow["longitude"] . "' LIMIT 1", "towns"); $townrow = mysql_fetch_array($townquery); $userrow["currenttown"] = "Welcome to <b>" . $townrow["name"] . "</b>.<br /><br />"; } else { $userrow["currenttown"] = ""; } if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; } elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "<a href=\"forum.php\">Forum</a><br />"; } elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "<a href=\"" . $controlrow["forumaddress"] . "\">Forum</a><br />"; } // Format various userrow stuffs... if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; } if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; } $userrow["experience"] = number_format($userrow["experience"]); $userrow["gold"] = number_format($userrow["gold"]); if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=\"admin.php\">Admin</a><br />"; } else { $userrow["adminlink"] = ""; } // HP/MP/TP bars. $stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100); if ($userrow["maxmp"] != 0) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100); } else { $statmp = 0; } $stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100); $stattable = "<table width=\"100\"><tr><td width=\"33%\">\n"; $stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n"; if ($stathp >= 66) { $stattable .= "<div style=\"padding:0px; height:" . $stathp . "px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; } if ($stathp < 66 && $stathp >= 33) { $stattable .= "<div style=\"padding:0px; height:" . $stathp . "px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; } if ($stathp < 33) { $stattable .= "<div style=\"padding:0px; height:" . $stathp . "px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; } $stattable .= "</td></tr></table></td><td width=\"33%\">\n"; $stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n"; if ($statmp >= 66) { $stattable .= "<div style=\"padding:0px; height:" . $statmp . "px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; } if ($statmp < 66 && $statmp >= 33) { $stattable .= "<div style=\"padding:0px; height:" . $statmp . "px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; } if ($statmp < 33) { $stattable .= "<div style=\"padding:0px; height:" . $statmp . "px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; } $stattable .= "</td></tr></table></td><td width=\"33%\">\n"; $stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n"; if ($stattp >= 66) { $stattable .= "<div style=\"padding:0px; height:" . $stattp . "px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; } if ($stattp < 66 && $stattp >= 33) { $stattable .= "<div style=\"padding:0px; height:" . $stattp . "px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; } if ($stattp < 33) { $stattable .= "<div style=\"padding:0px; height:" . $stattp . "px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; } $stattable .= "</td></tr></table></td>\n"; $stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n"; $userrow["statbars"] = $stattable; // Now make numbers stand out if they're low. if ($userrow["currenthp"] <= $userrow["maxhp"] / 5) { $userrow["currenthp"] = "<blink><span class=\"highlight\"><b>*" . $userrow["currenthp"] . "*</b></span></blink>"; } if ($userrow["currentmp"] <= $userrow["maxmp"] / 5) { $userrow["currentmp"] = "<blink><span class=\"highlight\"><b>*" . $userrow["currentmp"] . "*</b></span></blink>"; } $spellquery = doquery("SELECT id,name,type FROM {{table}}", "spells"); $userspells = explode(",", $userrow["spells"]); $userrow["magiclist"] = ""; while ($spellrow = mysql_fetch_array($spellquery)) { $spell = false; foreach ($userspells as $a => $b) { if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; } } if ($spell == true) { $userrow["magiclist"] .= "<a href=\"index.php?do=spell:" . $spellrow["id"] . "\">" . $spellrow["name"] . "</a><br />"; } } if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; } // Travel To list. $townslist = explode(",", $userrow["towns"]); $townquery2 = doquery("SELECT * FROM {{table}} ORDER BY id", "towns"); $userrow["townslist"] = ""; while ($townrow2 = mysql_fetch_array($townquery2)) { $town = false; foreach ($townslist as $a => $b) { if ($b == $townrow2["id"]) { $town = true; } } if ($town == true) { $userrow["townslist"] .= "<a href=\"index.php?do=gotown:" . $townrow2["id"] . "\">" . $townrow2["name"] . "</a><br />\n"; } } } else { $userrow = array(); } $finalarray = array("dkgamename" => $controlrow["gamename"], "title" => $title, "content" => $content, "rightnav" => parsetemplate($rightnav, $userrow), "leftnav" => parsetemplate($leftnav, $userrow), "topnav" => $topnav, "totaltime" => round(getmicrotime() - $starttime, 4), "numqueries" => $numqueries, "version" => $version, "build" => $build); $page = parsetemplate($template, $finalarray); if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); } echo $page; die; }