-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathadmin.php
More file actions
47 lines (45 loc) · 1.85 KB
/
Copy pathadmin.php
File metadata and controls
47 lines (45 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
'软件名称:MacCMS Pro 源码库:https://github.com/maccmspro
'--------------------------------------------------------
'Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
'遵循Apache2开源协议发布,并提供免费使用。
'--------------------------------------------------------
*/
header('Content-Type:text/html;charset=utf-8');
// 检测PHP环境
if(version_compare(PHP_VERSION,'5.5.0','<')) die('PHP版本需要>=5.5,请升级【PHP version requires > = 5.5,please upgrade】');
//超时时间
@ini_set('max_execution_time', '0');
//内存限制 取消内存限制
@ini_set("memory_limit",'-1');
// 定义应用目录
define('ROOT_PATH', __DIR__ . '/');
define('APP_PATH', __DIR__ . '/application/');
define('MAC_COMM', __DIR__ . '/application/common/common/');
define('MAC_HOME_COMM', __DIR__ . '/application/index/common/');
define('MAC_ADMIN_COMM', __DIR__ . '/application/admin/common/');
define('MAC_START_TIME', microtime(true) );
//define('BIND_MODULE','admin');
define('ENTRANCE', 'admin');
$in_file = rtrim($_SERVER['SCRIPT_NAME'],'/');
if(substr($in_file,strlen($in_file)-4)!=='.php'){
$in_file = substr($in_file,0,strpos($in_file,'.php')) .'.php';
}
define('IN_FILE', $in_file);
if (!is_file('./application/data/install/install.lock')) {
header("Location: ./install.php");
exit;
}
if (!@mb_check_encoding($_SERVER['PATH_INFO'], 'utf-8')) {
$_SERVER['PATH_INFO']=@mb_convert_encoding($_SERVER['PATH_INFO'], 'UTF-8', 'GBK');
}
// 环境检测
require ROOT_PATH . 'thinkphp/base.php';
$run = \think\App::run();
if(env('app_environment', 'production') == 'production' && strpos($_SERVER["SCRIPT_NAME"],'/admin.php') !== false) {
echo '请将后台入口文件admin.php改名,避免被黑客入侵攻击【Please rename the background entry file admin.php to avoid being hacked】';
exit;
}
// 执行应用
$run->send();