$arr_demerits['Witches Disturbed'] = $row['award_witchdisturb']; if (mysql_num_rows(mysql_query("SELECT * FROM players WHERE num='" . $row['num'] . "'")) > 0) { $tpl->set("title", "Viewing Player: " . htmlentities($row['name'], ENT_COMPAT, "UTF-8")); // Window title $tpl->set("page_heading", "Viewing Player: " . htmlentities($row['name'], ENT_COMPAT, "UTF-8")); // Page header $stats =& new Template('./templates/player.tpl'); $stats->set("player_name", htmlentities($row['name'], ENT_COMPAT, "UTF-8")); $stats->set("player_num", $row['num']); if (function_exists(bcadd)) { $stats->set("player_url", "<a href=\"http://steamcommunity.com/profiles/" . getfriendid($row['num']) . "\">" . htmlentities($row['name'], ENT_COMPAT, "UTF-8") . "'s Community Page</a>"); } else { $stats->set("player_url", "<b>Community page URL disabled</b>"); } $stats->set("player_lastonline", date("M d, Y g:ia", $row['lastontime']) . " (" . formatage(time() - $row['lastontime']) . " ago)"); $stats->set("player_playtime", formatage($row['playtime'] * 60) . " (" . number_format($row['playtime']) . " min)"); $stats->set("player_rank", $rank); $stats->set("player_points", number_format($row['points'])); $stats->set("player_kills", number_format($row['kills'])); $stats->set("player_headshots", number_format($row['headshots'])); if ($row['kills'] == 0 || $row['headshots'] == 0) { $stats->set("player_ratio", "0"); } else { $stats->set("player_ratio", number_format($row['headshots'] / $row['kills'], 4) * 100); } $stats->set("player_kpm", number_format($row['kills'] / $row['playtime'], 4)); $stats->set("player_ppm", number_format($row['points'] / $row['playtime'], 4)); $arr_achievements = array(); if ($row['kills'] > $population_minkills) { $popkills = getpopulation($row['kills'], $population_file, $population_cities); $arr_achievements[] = "<td><b>City Buster</b></td>\n <td>You have killed more zombies than the entire population of <a href=\"http://google.com/search?q=site:en.wikipedia.org+" . $popkills[0] . "&btnI=1\">" . $popkills[0] . "</a>, population " . number_format($popkills[1]) . ".<br />\n That is alomst more than the entire population of <a href=\"http://google.com/search?q=site:en.wikipedia.org+" . $popkills[2] . "&btnI=1\">" . $popkills[2] . "</a>, population " . number_format($popkills[3]) . ".</td>";
$page_prevpage = intval($page_current - 1); if ($page_prevpage < 0) { $page_prevpage = $page_maxpages; } if ($page_prevpage < 1) { $page_prevpage = 0; } $stats->set("page_prev", "playerlist.php?page=" . $page_prevpage); $stats->set("page_current", $page_current + 1); $stats->set("page_total", $page_maxpages + 1); $stats->set("page_next", "playerlist.php?page=" . $page_nextpage); $result = mysql_query("SELECT * FROM players ORDER BY points/playtime DESC LIMIT " . intval($page_current * $page_perpage) . "," . $page_perpage); $i = $page_current !== 0 ? 1 + intval($page_current * 100) : 1; while ($row = mysql_fetch_array($result)) { $line = $i & 1 ? "<tr>" : "<tr class=\"alt\">"; $line .= "<td align=\"center\">" . number_format($i) . "</td><td><a href=\"player.php?num=" . $row['num'] . "\">" . htmlentities($row['name'], ENT_COMPAT, "UTF-8") . "</a></td>"; $line .= "<td>" . number_format($row['points'] / $row['playtime'], 3, '.', '') . "</td>"; $line .= "<td>" . number_format($row['points']) . "</td>"; $line .= "<td>" . formatage($row['playtime'] * 60) . "</td>"; $line .= "<td>" . formatage(time() - $row['lastontime']) . " ago</td></tr>\n"; $arr_players[] = $line; $i++; } $stats->set("players", $arr_players); $output = $stats->fetch("./templates/ranking.tpl"); } $tpl->set('body', trim($output)); // Output the sidebar $tpl->set("top10", $top10); // Print out the page! echo $tpl->fetch("./templates/layout.tpl");
$tpl->set("title", "Players Online"); // Window title $tpl->set("page_heading", "Registered Players Online - " . $playercount); // Page header if (mysql_error()) { $output = "<p><b>MySQL Error:</b> " . mysql_error() . "</p>\n"; } else { $arr_online = array(); $stats =& new Template('./templates/online.tpl'); $i = 1; while ($row = mysql_fetch_array($result)) { if ($row['lastontime'] > time()) { $row['lastontime'] = time(); } $line = $i & 1 ? "<tr>" : "<tr class=\"alt\">"; $line .= "<td><a href=\"player.php?num=" . $row['num'] . "\">" . htmlentities($row['name'], ENT_COMPAT, "UTF-8") . "</a></td>"; $line .= "<td>" . number_format($row['points']) . "</td><td>" . formatage($row['playtime'] * 60) . "</td></tr>\n"; $i++; $arr_online[] = $line; } if (mysql_num_rows($result) == 0) { $arr_online[] = "<tr><td colspan=\"3\" align=\"center\">There are no players online</td</tr>\n"; } $stats->set("online", $arr_online); $output = $stats->fetch("./templates/online.tpl"); } $tpl->set('body', trim($output)); // Output the top 10 $tpl->set("top10", $top10); // Print out the page! echo $tpl->fetch("./templates/layout.tpl");
echo $tpl->fetch("./templates/layout.tpl"); exit; } $tpl->set("site_name", $site_name); // Site name $tpl->set("title", $title . " Stats"); // Window title $tpl->set("page_heading", $title . " Stats"); // Page header $totalkills = 0; $result = mysql_query("SELECT * FROM maps WHERE name LIKE '" . $campaign . "%' ORDER BY name ASC"); while ($row = mysql_fetch_array($result)) { $stats =& new Template('./templates/page.tpl'); $stats->set("page_subject", $row['name']); $map =& new Template('./templates/maps_detailed.tpl'); $playtime_arr = array(formatage($row['playtime_nor'] * 60), formatage($row['playtime_adv'] * 60), formatage($row['playtime_exp'] * 60), formatage($row['playtime_nor'] * 60 + $row['playtime_adv'] * 60 + $row['playtime_exp'] * 60)); $points_arr = array(number_format($row['points_nor']), number_format($row['points_adv']), number_format($row['points_exp']), number_format($row['points_nor'] + $row['points_adv'] + $row['points_exp'])); $kills_arr = array(number_format($row['kills_nor']), number_format($row['kills_adv']), number_format($row['kills_exp']), number_format($row['kills_nor'] + $row['kills_adv'] + $row['kills_exp'])); $restarts_arr = array(number_format($row['restarts_nor']), number_format($row['restarts_adv']), number_format($row['restarts_exp']), number_format($row['restarts_nor'] + $row['restarts_adv'] + $row['restarts_exp'])); $totalkills = $totalkills + ($row['kills_nor'] + $row['kills_adv'] + $row['kills_exp']); $map->set("playtime", $playtime_arr); $map->set("points", $points_arr); $map->set("kills", $kills_arr); $map->set("restarts", $restarts_arr); $body = $map->fetch("./templates/maps_detailed.tpl"); $stats->set("page_body", $body); $output .= $stats->fetch("./templates/page.tpl"); } $campaignpop = getpopulation($totalkills, $population_file, False); $campaigninfo = "<p>More zombies have been killed in <b>" . $title . "</b> than the entire population of <a href=\"http://google.com/search?q=site:en.wikipedia.org+" . $campaignpop[0] . "&btnI=1\">" . $campaignpop[0] . "</a>, population <b>" . number_format($campaignpop[1]) . "</b>.<br />That is almost more than the entire population of <a href=\"http://google.com/search?q=site:en.wikipedia.org+" . $campaignpop[2] . "&btnI=1\">" . $campaignpop[2] . "</a>, population <b>" . number_format($campaignpop[3]) . "</b>!</p>\n"; $tpl->set("body", trim($campaigninfo . $output));
Rank Awards page - "awards.php" ================================================ */ // Include the primary PHP functions file include "./common.php"; // Load outer template $tpl = new Template("./templates/layout.tpl"); // Include award file include "./" . $award_file; $awardarr = array("kills" => $award_kills, "headshots" => $award_headshots, "kill_infected" => $award_killinfected, "kill_hunter" => $award_killhunter, "kill_smoker" => $award_killsmoker, "kill_boomer" => $award_killboomer, "award_pills" => $award_pills, "award_medkit" => $award_medkit, "award_hunter" => $award_hunter, "award_smoker" => $award_smoker, "award_protect" => $award_protect, "award_revive" => $award_revive, "award_rescue" => $award_rescue, "award_campaigns" => $award_campaigns, "award_tankkill" => $award_tankkill, "award_tankkillnodeaths" => $award_tankkillnodeaths, "award_allinsafehouse" => $award_allinsafehouse, "award_friendlyfire" => $award_friendlyfire, "award_teamkill" => $award_teamkill, "award_left4dead" => $award_left4dead, "award_letinsafehouse" => $award_letinsafehouse, "award_witchdisturb" => $award_witchdisturb); $cachedate = filemtime("./templates/awards_cache.html"); if ($cachedate < time() - 60 * $award_cache_refresh) { $row = mysql_fetch_array(mysql_query("SELECT * FROM players ORDER BY playtime DESC LIMIT 1")); $row2 = mysql_fetch_array(mysql_query("SELECT * FROM players ORDER BY playtime DESC LIMIT 1,1")); $table_body .= "<tr><td>" . sprintf($award_time, "player.php?steamid=" . $row['steamid'], htmlentities($row['name'], ENT_COMPAT, "UTF-8"), formatage($row['playtime'] * 60)) . "<br />\n"; $table_body .= "<i style=\"font-size: 12px;\">" . sprintf($award_second, "player.php?steamid=" . $row2['steamid'], htmlentities($row2['name'], ENT_COMPAT, "UTF-8"), formatage($row2['playtime'] * 60)) . "</i></td></tr>\n"; $headshotratiosql = "playtime >= " . $award_minplaytime . " AND points >= " . $award_minpoints . " AND kills >= " . $award_minkills . " AND headshots >= " . $award_minheadshots; $row = mysql_fetch_array(mysql_query("SELECT * FROM players WHERE " . $headshotratiosql . " ORDER BY (headshots/kills) DESC LIMIT 1")); $row2 = mysql_fetch_array(mysql_query("SELECT * FROM players WHERE " . $headshotratiosql . " ORDER BY (headshots/kills) DESC LIMIT 1,1")); if ($row['headshots'] && $row['kills']) { $table_body .= "<tr><td>" . sprintf($award_ratio, "player.php?steamid=" . $row['steamid'], htmlentities($row['name'], ENT_COMPAT, "UTF-8"), number_format($row['headshots'] / $row['kills'], 4) * 100) . "<br />\n"; $table_body .= "<i style=\"font-size: 12px;\">" . sprintf($award_second, "player.php?steamid=" . $row2['steamid'], htmlentities($row2['name'], ENT_COMPAT, "UTF-8"), number_format($row2['headshots'] / $row2['kills'], 4) * 100 . "%") . "</i></td></tr>\n"; } foreach ($awardarr as $award => $awardstring) { $awardtmp = array(); $steamid = array(); $awardsql = $award !== "award_teamkill" || $award !== "award_friendlyfire" ? " WHERE playtime >= " . $award_minplaytime . " AND points >= " . $award_minpointstotal : ""; $result = mysql_query("SELECT * FROM players " . $awardsql . " ORDER BY " . $award . " DESC LIMIT 2"); while ($row = mysql_fetch_array($result)) { $awardtmp[] = array(htmlentities($row['name'], ENT_COMPAT, "UTF-8"), $row[$award] . ""); $steamid[] = $row['steamid'];
} $line = $i & 1 ? "<tr>" : "<tr class=\"alt\">"; $maparr[] = $line . "<td><b>SERVER TOTAL</b></td><td><b>" . formatage($totals['playtime']) . "</b></td><td><b>" . number_format($totals['points']) . "</b></td><td><b>" . number_format($totals['kills']) . "</b></td><td><b>" . number_format($totals['restarts']) . "</b></td></tr>\n"; $stats =& new Template('./templates/maps_overview.tpl'); $totalpop = getpopulation($totals['kills'], $population_file, True); $stats->set("totalpop", $totalpop); $stats->set("maps", $maparr); $output = $stats->fetch("./templates/maps_overview.tpl"); foreach ($campaigns as $prefix => $title) { $stats =& new Template('./templates/page.tpl'); $stats->set("page_subject", $title); $maps =& new Template('./templates/maps_campaign.tpl'); $maparr = array(); $result = mysql_query("SELECT name, playtime_nor + playtime_adv + playtime_exp as playtime,\n points_nor + points_adv + points_exp as points,\n kills_nor + kills_adv + kills_exp as kills,\n restarts_nor + restarts_adv + restarts_exp as restarts FROM maps WHERE name like '" . $prefix . "%' ORDER BY name ASC"); $i = 1; while ($row = mysql_fetch_array($result)) { $line = $i & 1 ? "<tr>" : "<tr class=\"alt\">"; $maparr[] = $line . "<td>" . $row['name'] . "</td><td>" . formatage($row['playtime'] * 60) . "</td><td>" . number_format($row['points']) . "</td><td>" . number_format($row['kills']) . "</td><td>" . number_format($row['restarts']) . "</td></tr>\n"; $i++; } $maps->set("maps", $maparr); $body = $maps->fetch("./templates/maps_campaign.tpl"); $stats->set("page_body", $body); $stats->set("page_link", "<a href=\"campaign.php?id=" . $prefix . "\">View Full Stats for " . $title . "</a>"); $output .= $stats->fetch("./templates/page.tpl"); } $tpl->set("body", trim($output)); // Output the top 10 $tpl->set("top10", $top10); // Print out the page! echo $tpl->fetch("./templates/layout.tpl");