Guest User

Untitled

a guest
Oct 16th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. <?php
  2. /////////////////////////////////////////////////////////////////
  3. // FILENAME : stats.php
  4. // COPYRGIHT : (C) 2005, Invader
  5. // WWW : N/A
  6. /////////////////////////////////////////////////////////////////
  7. define ( IN_PHPBB, true );
  8. $phpbb_root_path = '/var/www/html/phpbb3/';
  9. $phpEx = "php" ;
  10. //include ( $phpbb_root_path . 'extension.inc' );
  11. include ( $phpbb_root_path . 'common.'.$phpEx );
  12.  
  13. $userdata = session_pagestart ( $user_ip, PAGE_INDEX );
  14. init_userprefs ( $userdata );
  15. include ( $phpbb_root_path . 'includes/page_header.'.$phpEx );
  16.  
  17. $mode = intval ( $_GET[ 'mode' ] );
  18. $look_up = $_POST[ 'player' ];
  19. $pp = 50;
  20.  
  21. $lang[ 'stats_find' ] = 'Find a Player';
  22. $lang[ 'stats_high' ] = 'High Scores';
  23. $lang[ 'stats_ladder' ] = 'Ladder';
  24. $lang[ 'stats_wonr' ] = 'Won Rounds';
  25. $lang[ 'stats_wonm' ] = 'Won Matches';
  26.  
  27. $file_array = array (
  28. './highscores.txt',
  29. './ladder.txt',
  30. './won_rounds.txt',
  31. './won_matches.txt',
  32. );
  33.  
  34. foreach ( $file_array AS $file )
  35. {
  36. preg_match_all ( '#(\d+)\s+(.*)#', file_get_contents ( $file ), $result );
  37. unset ( $result[ 0 ] );
  38.  
  39. $result_3 = array ( );
  40. $total = sizeof ( $result[ 1 ] );
  41.  
  42. for ( $i = 0; $i < $total; $i++ )
  43. {
  44. $result_3[ $result[ 2 ][ $i ] ] = $result[ 1 ][ $i ];
  45. }
  46.  
  47. if ( $file == './ladder.txt' )
  48. {
  49. //sort ( $result_3 );
  50. }
  51.  
  52. $file_modified = str_replace ( array ( './', '.txt' ), '', $file );
  53. $file_modified = str_replace ( '_', ' ', $file_modified );
  54.  
  55. $template->assign_block_vars ( 'block_table', array (
  56. 'S_FILE' => strtoupper ( $file_modified ) )
  57. );
  58.  
  59. $count = 1;
  60. foreach ( $result_3 AS $key => $value )
  61. {
  62. if ( $count++ > $pp )
  63. {
  64. break;
  65. }
  66. else
  67. {
  68. if ( !empty ( $look_up ) && strtolower ( $key ) == strtolower ( $look_up ) )
  69. {
  70. $template->assign_block_vars ( 'block_player', array (
  71. 'S_KEY' => $key,
  72. 'S_VALUE' => $value,
  73. 'S_FILE' => strtoupper ( $file_modified ) )
  74. );
  75. }
  76.  
  77. $template->assign_block_vars ( 'block_table.block_data', array (
  78. 'S_KEY' => $key,
  79. 'S_VALUE' => $value )
  80. );
  81. }
  82. }
  83. }
  84.  
  85. $template->assign_vars ( array (
  86. 'S_ACTION' => append_sid ( 'stats.php' ),
  87. 'L_FIND' => $lang[ 'stats_find' ],
  88. 'L_HIGHSCORES' => $lang[ 'stats_high' ],
  89. 'L_LADDER' => $lang[ 'stats_ladder' ],
  90. 'L_WONR' => $lang[ 'stats_wonr' ],
  91. 'L_WONM' => $lang[ 'stats_wonm' ] )
  92. );
  93. $template->set_filenames ( array (
  94. 'body' => 'stats.tpl' )
  95. );
  96. $template->pparse ( 'body' );
  97.  
  98. include ( $phpbb_root_path . 'includes/page_tail.'.$phpEx );
  99. ?>
  100.  
  101.  
Advertisement
Add Comment
Please, Sign In to add comment