Просмотр файла common.php

Размер файла: 4.68Kb
  1. <?php
  2. /***************************************************************************
  3. * mides.ru
  4. * -------------------
  5. ***************************************************************************/
  6. if ( !defined('IN_PHPBB') )
  7. {
  8. die("Hacking attempt");
  9. }
  10.  
  11. error_reporting (E_ERROR | E_WARNING | E_PARSE);
  12. set_magic_quotes_runtime(0);
  13.  
  14. if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off'))
  15. {
  16. $HTTP_POST_VARS = $_POST;
  17. $HTTP_GET_VARS = $_GET;
  18. $HTTP_SERVER_VARS = $_SERVER;
  19. $HTTP_COOKIE_VARS = $_COOKIE;
  20. $HTTP_ENV_VARS = $_ENV;
  21. $HTTP_POST_FILES = $_FILES;
  22.  
  23. if (isset($_SESSION))
  24. {
  25. $HTTP_SESSION_VARS = $_SESSION;
  26. }
  27. }
  28.  
  29. if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS']))
  30. {
  31. die("Hacking attempt");
  32. }
  33.  
  34. if (isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS))
  35. {
  36. die("Hacking attempt");
  37. }
  38.  
  39. if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
  40. {
  41. $not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');
  42.  
  43. if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
  44. {
  45. $HTTP_SESSION_VARS = array();
  46. }
  47.  
  48. $input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);
  49.  
  50. unset($input['input']);
  51. unset($input['not_unset']);
  52.  
  53. while (list($var,) = @each($input))
  54. {
  55. if (in_array($var, $not_unset))
  56. {
  57. die('Hacking attempt!');
  58. }
  59. unset($$var);
  60. }
  61.  
  62. unset($input);
  63. }
  64.  
  65. if( !get_magic_quotes_gpc() )
  66. {
  67. if( is_array($HTTP_GET_VARS) )
  68. {
  69. while( list($k, $v) = each($HTTP_GET_VARS) )
  70. {
  71. if( is_array($HTTP_GET_VARS[$k]) )
  72. {
  73. while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
  74. {
  75. $HTTP_GET_VARS[$k][$k2] = addslashes($v2);
  76. }
  77. @reset($HTTP_GET_VARS[$k]);
  78. }
  79. else
  80. {
  81. $HTTP_GET_VARS[$k] = addslashes($v);
  82. }
  83. }
  84. @reset($HTTP_GET_VARS);
  85. }
  86.  
  87. if( is_array($HTTP_POST_VARS) )
  88. {
  89. while( list($k, $v) = each($HTTP_POST_VARS) )
  90. {
  91. if( is_array($HTTP_POST_VARS[$k]) )
  92. {
  93. while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
  94. {
  95. $HTTP_POST_VARS[$k][$k2] = addslashes($v2);
  96. }
  97. @reset($HTTP_POST_VARS[$k]);
  98. }
  99. else
  100. {
  101. $HTTP_POST_VARS[$k] = addslashes($v);
  102. }
  103. }
  104. @reset($HTTP_POST_VARS);
  105. }
  106.  
  107. if( is_array($HTTP_COOKIE_VARS) )
  108. {
  109. while( list($k, $v) = each($HTTP_COOKIE_VARS) )
  110. {
  111. if( is_array($HTTP_COOKIE_VARS[$k]) )
  112. {
  113. while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
  114. {
  115. $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
  116. }
  117. @reset($HTTP_COOKIE_VARS[$k]);
  118. }
  119. else
  120. {
  121. $HTTP_COOKIE_VARS[$k] = addslashes($v);
  122. }
  123. }
  124. @reset($HTTP_COOKIE_VARS);
  125. }
  126. }
  127.  
  128. $board_config = array();
  129. $userdata = array();
  130. $theme = array();
  131. $images = array();
  132. $lang = array();
  133. $nav_links = array();
  134. $gen_simple_header = FALSE;
  135.  
  136. include($phpbb_root_path . 'config.'.$phpEx);
  137.  
  138. if( !defined("PHPBB_INSTALLED") )
  139. {
  140. header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx);
  141. exit;
  142. }
  143.  
  144. include($phpbb_root_path . 'includes/functions_u2w.'.$phpEx);
  145. include($phpbb_root_path . 'includes/constants.'.$phpEx);
  146. include($phpbb_root_path . 'includes/template.'.$phpEx);
  147. include($phpbb_root_path . 'includes/sessions.'.$phpEx);
  148. include($phpbb_root_path . 'includes/auth.'.$phpEx);
  149. include($phpbb_root_path . 'includes/functions.'.$phpEx);
  150. include($phpbb_root_path . 'includes/db.'.$phpEx);
  151.  
  152. unset($dbpasswd);
  153.  
  154. $user_agent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
  155. if (getenv("HTTP_X_FORWARDED_FOR"))
  156. {
  157. $client_ip = getenv("HTTP_X_FORWARDED_FOR");
  158. } else {
  159. $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
  160. }
  161. $user_ip = encode_ip($client_ip);
  162.  
  163. $sql = "SELECT *
  164. FROM " . CONFIG_TABLE;
  165. if( !($result = $db->sql_query($sql)) )
  166. {
  167. message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
  168. }
  169.  
  170. while ( $row = $db->sql_fetchrow($result) )
  171. {
  172. $board_config[$row['config_name']] = $row['config_value'];
  173. }
  174. include($phpbb_root_path . 'attach_mod/attachment_mod.'.$phpEx);
  175.  
  176. if (file_exists('install'))
  177. {
  178. message_die(GENERAL_MESSAGE, 'Please_remove_install');
  179. }
  180.  
  181. if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") )
  182. {
  183. message_die(GENERAL_MESSAGE, 'Board_disable', 'Information');
  184. }
  185.  
  186. ?>