使用PHP开发的简约导航/书签管理系统。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

4 years ago
<?php
/**
* name:入口文件
*/
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
3 years ago
header("content-Type: text/html; charset=Utf-8");
4 years ago
//获取控制器
$c = @$_GET['c'];
//进行过滤
$c = strip_tags($c);
//读取版本号
//$version = @file_get_contents("./functions/version.txt");
//载入配置文件
3 years ago
//如果配置文件不存在,则载入初始化文件
4 years ago
if( !file_exists('./data/config.php') ) {
3 years ago
include_once("controller/init.php");
3 years ago
//exit('<h3>配置文件不存在,请将站点目录下的config.simple.php复制为data/config.php</h3>');
4 years ago
}
4 years ago
//检查数据库是否存在,不存在则复制数据库
4 years ago
if( !file_exists('./data/onenav.db3') ) {
3 years ago
if ( !copy('db/onenav.simple.db3','data/onenav.db3') ) {
exit("数据库复制失败,请检查目录权限!");
}
4 years ago
// copy('db/.htaccess','data/.htaccess');
4 years ago
}
4 years ago
//载入配置文件
4 years ago
require("./data/config.php");
4 years ago
//根据不同的请求载入不同的方法
//如果没有请求控制器
if((!isset($c)) || ($c == '')){
//载入主页
include_once("./controller/index.php");
}
else{
3 years ago
//对请求参数进行过滤,同时检查文件是否存在
3 years ago
$c = str_replace('\\','/',$c);
$pattern = "%\./%";
if ( preg_match_all($pattern,$c) ) {
exit('非法请求!');
}
3 years ago
//控制器文件
$controller_file = "./controller/".$c.'.php';
if( file_exists($controller_file) ) {
include_once($controller_file);
} else{
exit('Controller not exist!');
}
4 years ago
}