Example #1
0
        }
        $recent_attackers_section .= '</ul>';
    }
    return $recent_attackers_section;
}
function get_recent_attackers()
{
    $recent_attackers = array();
    $user_id = get_user_id();
    $sql = new DBAccess();
    $q = 'select distinct send_from, uname, level, health from events join players on send_from = player_id where send_to = \'' . sql($user_id) . '\' limit 20';
    $sql->Query($q);
    $recent_attackers = $sql->FetchAll();
    return $recent_attackers;
}
$active_ninja = render_active(5, $alive_only = true);
// Display the currently active ninjas
$match_string = in('enemy_match', null, 'no filter');
$add_enemy = in('add_enemy', null, 'toInt');
$remove_enemy = in('remove_enemy', null, 'toInt');
$enemy_limit = 20;
$max_enemies = false;
$enemy_list = get_setting('enemy_list');
if ($match_string) {
    $found_enemies = render_enemy_matches($match_string);
}
if (is_numeric($remove_enemy)) {
    remove_enemy($remove_enemy);
    $enemy_list = get_setting('enemy_list');
    // Update to new enemy list.
}
//$microtimes[5] = microtime();
ob_start();
display_search_form($hide, $page, $searched, $dead_count);
$search_form = ob_get_contents();
ob_end_clean();
//$microtimes[6] = microtime();
// Display the nav
ob_start();
player_list_nav($page, $hide, $searched, $record_limit, $totalrows, $numofpages);
$player_list_nav = ob_get_contents();
ob_end_clean();
//$microtimes[7] = microtime();
$active_ninja = '';
if (!$searched) {
    // Will not display active ninja on a search page.
    $active_ninja = render_active(5, $alive_only);
    // Display the currently active ninjas
}
//$microtimes[8] = microtime();
$players = $sql->FetchAll();
//$microtimes[9] = microtime();
// Render each of the player rows.
$i = 0;
$player_rows = '';
foreach ($players as $a_player) {
    $i++;
    $level_cat = level_category($a_player['level']);
    $parts = array('alive_class' => $a_player['alive'] == 1 ? "AliveRow" : "DeadRow", 'odd_or_even' => $i % 2 ? "odd" : "even", 'player_rank' => $a_player['rank_id'], 'player_id' => $a_player['player_id'], 'page' => $page, 'uname' => $a_player['uname'], 'level_cat_css' => $level_cat['css'], 'level_cat' => $level_cat['display'], 'level' => $a_player['level'], 'class' => $a_player['class'], 'WEB_ROOT' => WEB_ROOT, 'clan' => $a_player['clan'], 'alive' => $a_player['alive'] ? "&nbsp;" : "Dead");
    $player_rows .= render_template('player_list_row.tpl', $parts);
    // Add all the player rows on to a big list of 'em.
}