Guest User

Untitled

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