Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /////////////////////////////////////////////////////////////////
- // FILENAME : stats.php
- // COPYRGIHT : (C) 2005, Invader
- // WWW : N/A
- /////////////////////////////////////////////////////////////////
- define ( IN_PHPBB, true );
- $phpbb_root_path = './';
- include ( $phpbb_root_path . 'extension.inc' );
- include ( $phpbb_root_path . 'common.'.$phpEx );
- $userdata = session_pagestart ( $user_ip, PAGE_INDEX );
- init_userprefs ( $userdata );
- include ( $phpbb_root_path . 'includes/page_header.'.$phpEx );
- $mode = intval ( $_GET[ 'mode' ] );
- $look_up = $_POST[ 'player' ];
- $pp = 50;
- $lang[ 'stats_find' ] = 'Find a Player';
- $lang[ 'stats_high' ] = 'High Scores';
- $lang[ 'stats_ladder' ] = 'Ladder';
- $lang[ 'stats_wonr' ] = 'Won Rounds';
- $lang[ 'stats_wonm' ] = 'Won Matches';
- $file_array = array (
- './highscores.txt',
- './ladder.txt',
- './won_rounds.txt',
- './won_matches.txt',
- );
- foreach ( $file_array AS $file )
- {
- preg_match_all ( '#(\d+)\s+(.*)#', file_get_contents ( $file ), $result );
- unset ( $result[ 0 ] );
- $result_3 = array ( );
- $total = sizeof ( $result[ 1 ] );
- for ( $i = 0; $i < $total; $i++ )
- {
- $result_3[ $result[ 2 ][ $i ] ] = $result[ 1 ][ $i ];
- }
- if ( $file == './ladder.txt' )
- {
- //sort ( $result_3 );
- }
- $file_modified = str_replace ( array ( './', '.txt' ), '', $file );
- $file_modified = str_replace ( '_', ' ', $file_modified );
- $template->assign_block_vars ( 'block_table', array (
- 'S_FILE' => strtoupper ( $file_modified ) )
- );
- $count = 1;
- foreach ( $result_3 AS $key => $value )
- {
- if ( $count++ > $pp )
- {
- break;
- }
- else
- {
- if ( !empty ( $look_up ) && strtolower ( $key ) == strtolower ( $look_up ) )
- {
- $template->assign_block_vars ( 'block_player', array (
- 'S_KEY' => $key,
- 'S_VALUE' => $value,
- 'S_FILE' => strtoupper ( $file_modified ) )
- );
- }
- $template->assign_block_vars ( 'block_table.block_data', array (
- 'S_KEY' => $key,
- 'S_VALUE' => $value )
- );
- }
- }
- }
- $template->assign_vars ( array (
- 'S_ACTION' => append_sid ( 'stats.php' ),
- 'L_FIND' => $lang[ 'stats_find' ],
- 'L_HIGHSCORES' => $lang[ 'stats_high' ],
- 'L_LADDER' => $lang[ 'stats_ladder' ],
- 'L_WONR' => $lang[ 'stats_wonr' ],
- 'L_WONM' => $lang[ 'stats_wonm' ] )
- );
- $template->set_filenames ( array (
- 'body' => 'stats.tpl' )
- );
- $template->pparse ( 'body' );
- include ( $phpbb_root_path . 'includes/page_tail.'.$phpEx );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment