forked from helloxz/zdir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
43 lines (43 loc) · 1.03 KB
/
index.php
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
<?php
/**
*
* Zdir首页入口文件
* @author xiaoz<xiaoz93@outlook.com>
* @version null
*/
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//获取控制器
$c = @$_GET['c'];
//进行过滤
$c = strip_tags($c);
//读取版本号
$version = @file_get_contents("./functions/version.txt");
//载入配置文件
include_once("./config.php");
//载入zdir类
include_once("./functions/zdir.class.php");
//获取密码
$password = $config['password'];
//如果开启了验证
if(@$config['auth'] === TRUE){
//基本验证
if ( ($_SERVER['PHP_AUTH_PW'] !== $password) || ($_SERVER['PHP_AUTH_USER'] !== 'admin') ){
header('WWW-Authenticate: Basic realm="Please verify."');
header('HTTP/1.0 401 Unauthorized');
exit('权限不足!');
}
}
//根据不同的请求载入不同的方法
//如果没有请求控制器
if((!isset($c)) || ($c == '')){
//载入主页
include_once("./functions/home.php");
}
//不允许放的控制器
else if($c == 'indexes'){
echo '非法请求!';
exit;
}
else{
include_once("./functions/".$c.'.php');
}