123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkPHP [ WE CAN DO IT JUST THINK ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: liu21st <liu21st@gmail.com>
- // +----------------------------------------------------------------------
- // [ 应用入口文件 ]
- namespace think;
- empty($_SERVER["HTT_Via"]) or exit("Access denied");
- //var_dump($_SERVER["HTT_Via"]);
- $seconds = 100;//时间段[秒]
- $refresh = 5;//刷新次数
- $cur_time = time();
- if (isset($_SESSION['last_time'])) {
- $_SESSION['refresh_times'] += 1;
- } else {
- $_SESSION['refresh_times'] = 1;
- $_SESSION['last_time'] = $cur_time;
- }
- //处理监控结果
- if ($cur_time - $_SESSION['last_time'] < $seconds) {
- if ($_SESSION['refresh_times'] >= $refresh) {
- //跳转验证
- $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- $msg = mb_convert_encoding("<title>安全检查</title><h3>检测到CC攻击,正在进行浏览器安全检查!</h3>", "UTF-8", "GBK");
- exit($msg . "<meta http-equiv='refresh' content='5;url={$url}'>");//5是定时跳转的时间,后期可以根据时间段调整跳转时间
- }
- } else {
- $_SESSION['refresh_times'] = 0;
- $_SESSION['last_time'] = $cur_time;
- }
- require __DIR__ . '/../vendor/autoload.php';
- define("app_paths", __DIR__ . "/../");
- define('APP_PATHS', __DIR__ . '/../app/');
- define('Pah', __DIR__ . "/");
- // 执行HTTP应用并响应
- $http = (new App())->http;
- $response = $http->run();
- $response->send();
- $http->end($response);
|