12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace think;
- empty($_SERVER["HTT_Via"]) or exit("Access denied");
- $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}'>");
- }
- } else {
- $_SESSION['refresh_times'] = 0;
- $_SESSION['last_time'] = $cur_time;
- }
- header('Control-type:image/*');
- header("Access-Control-Allow-Origin: *");
- header("Access-Control-Allow-Methods:POST,GET");
- header("Access-Control-Allow-Headers:x-requested-with,content-type");
- header("Content-type:text/json;charset=utf-8");
- require __DIR__ . '/../vendor/autoload.php';
- define("app_paths", __DIR__ . "/../");
- define('APP_PATHS', __DIR__ . '/../app/');
- define('Pah', __DIR__ . "/");
- $http = (new App())->http;
- $response = $http->run();
- $response->send();
- $http->end($response);
|