Beispiel #1
0
// 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));
// Output the top 10
$tpl->set("top10", $top10);
// Print out the page!
echo $tpl->fetch("./templates/layout.tpl");
Beispiel #2
0
    $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>";
    }
    if (count($arr_achievements) === 0) {
        $arr_achievements[] = "<td><b>N/A</b></td><td>You have not yet earned any achievements.</td>";
    }
    arsort($arr_kills);
    arsort($arr_awards);
    arsort($arr_demerits);
    $stats->set("arr_kills", $arr_kills);
    $stats->set("arr_awards", $arr_awards);
    $stats->set("arr_demerits", $arr_demerits);
    $stats->set("arr_achievements", $arr_achievements);
    $output = $stats->fetch("./templates/player.tpl");
} else {
    $tpl->set("title", "Viewing Player: INVALID");
Beispiel #3
0
        $points = $points + $row['points'];
        $kills = $kills + $row['kills'];
        $restarts = $restarts + $row['restarts'];
    }
    $totals['playtime'] = $totals['playtime'] + $playtime * 60;
    $totals['points'] = $totals['points'] + $points;
    $totals['kills'] = $totals['kills'] + $kills;
    $totals['restarts'] = $totals['restarts'] + $restarts;
    $line = $i & 1 ? "<tr>" : "<tr class=\"alt\">";
    $maparr[] = $line . "<td>" . $title . "</td><td>" . formatage($playtime * 60) . "</td><td>" . number_format($points) . "</td><td>" . number_format($kills) . "</td><td>" . number_format($restarts) . "</td></tr>\n";
    $i++;
}
$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++;
    }