admin.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. '软件名称:苹果CMS 源码库:https://github.com/magicblack
  4. '--------------------------------------------------------
  5. 'Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  6. '遵循Apache2开源协议发布,并提供免费使用。
  7. '--------------------------------------------------------
  8. */
  9. header('Content-Type:text/html;charset=utf-8');
  10. // 检测PHP环境
  11. if(version_compare(PHP_VERSION,'5.5.0','<')) die('PHP版本需要>=5.5,请升级【PHP version requires > = 5.5,please upgrade】');
  12. //超时时间
  13. @ini_set('max_execution_time', '0');
  14. //内存限制 取消内存限制
  15. @ini_set("memory_limit",'-1');
  16. // 定义应用目录
  17. define('ROOT_PATH', __DIR__ . '/');
  18. define('APP_PATH', __DIR__ . '/application/');
  19. define('MAC_COMM', __DIR__.'/application/common/common/');
  20. define('MAC_HOME_COMM', __DIR__.'/application/index/common/');
  21. define('MAC_ADMIN_COMM', __DIR__.'/application/admin/common/');
  22. define('MAC_START_TIME', microtime(true) );
  23. //define('BIND_MODULE','admin');
  24. define('ENTRANCE', 'admin');
  25. $in_file = rtrim($_SERVER['SCRIPT_NAME'],'/');
  26. if(substr($in_file,strlen($in_file)-4)!=='.php'){
  27. $in_file = substr($in_file,0,strpos($in_file,'.php')) .'.php';
  28. }
  29. define('IN_FILE',$in_file);
  30. if(!is_file('./application/data/install/install.lock')) {
  31. header("Location: ./install.php");
  32. exit;
  33. }
  34. if(strpos($_SERVER["SCRIPT_NAME"],'/admin.php')!==false){
  35. echo '请将后台入口文件admin.php改名,避免被黑客入侵攻击【Please rename the background entry file admin.php to avoid being hacked】';
  36. exit;
  37. }
  38. if (!@mb_check_encoding($_SERVER['PATH_INFO'], 'utf-8')){
  39. $_SERVER['PATH_INFO']=@mb_convert_encoding($_SERVER['PATH_INFO'], 'UTF-8', 'GBK');
  40. }
  41. // 加载框架引导文件
  42. require __DIR__ . '/thinkphp/start.php';