-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.php
More file actions
32 lines (27 loc) · 1.4 KB
/
index.php
File metadata and controls
32 lines (27 loc) · 1.4 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
<?php
if (PHP_SAPI !== 'cli') { // не вкл. защиту для CRON и локального запуска php
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$file_name = pathinfo($request_uri, PATHINFO_FILENAME);
if (
$file_name != 'xhr' && $file_name != 'favicon'
&& !isset($isInclude)
) { // нужно для совместимости с подключением через .htaccess
$isInclude = true; // блокирует повторное подключение (совместимость с подключением через .htaccess)
include "includes/autoload.php";
// Инициализация и запуск системы
try {
$antiBot = \WAFSystem\WAFSystem::getInstance();
if ($antiBot->enabled) {
$antiBot->IFrameChecker->HeaderBlock(); // блокировка отображения в IFrame
if (isset($_GET['awafblock'])) // переменная блокировки через JS
$antiBot->Template->showBlockPage();
$antiBot->run();
}
} catch (Exception $e) {
error_log("AntiBot system failed: " . $e->getMessage());
error_log("Stack trace: " . $e->getTraceAsString());
header("HTTP/1.1 500 Internal Server Error");
exit;
}
}
}