1
0

admin.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. try {
  13. //超时时间
  14. ini_set('max_execution_time', '0');
  15. //内存限制 取消内存限制
  16. ini_set("memory_limit",'-1');
  17. // 定义应用目录
  18. define('ROOT_PATH', __DIR__ . '/');
  19. define('APP_PATH', __DIR__ . '/application/');
  20. define('MAC_COMM', __DIR__.'/application/common/common/');
  21. define('MAC_HOME_COMM', __DIR__.'/application/index/common/');
  22. define('MAC_ADMIN_COMM', __DIR__.'/application/admin/common/');
  23. define('MAC_START_TIME', microtime(true) );
  24. //define('BIND_MODULE','admin');
  25. define('ENTRANCE', 'admin');
  26. $in_file = rtrim($_SERVER['SCRIPT_NAME'],'/');
  27. if(substr($in_file,strlen($in_file)-4)!=='.php'){
  28. $in_file = substr($in_file,0,strpos($in_file,'.php')) .'.php';
  29. }
  30. define('IN_FILE',$in_file);
  31. if(!is_file('./application/data/install/install.lock')) {
  32. header("Location: ./install.php");
  33. exit;
  34. }
  35. if(strpos($_SERVER["SCRIPT_NAME"],'/admin.php')!==false){
  36. echo '请将后台入口文件admin.php改名,避免被黑客入侵攻击【Please rename the background entry file admin.php to avoid being hacked】';
  37. exit;
  38. }
  39. if (!mb_check_encoding($_SERVER['PATH_INFO'], 'utf-8')){
  40. $_SERVER['PATH_INFO']=mb_convert_encoding($_SERVER['PATH_INFO'], 'UTF-8', 'GBK');
  41. }
  42. // 加载框架引导文件
  43. require __DIR__ . '/thinkphp/start.php';
  44. } catch (Exception $e) {
  45. error_log('Throws error: '.$e->getMessage().' in '.$e->getFile().' on line '.$e->getLine());
  46. }