[+] добавлен фгал использования DDoS Guard

This commit is contained in:
rsgrinko committed 2023-10-07 14:14:25 +03:00
1 parent d47f2d0034
commit d8a2c8c82b
2 files changed
+8 -1

No files matched your search

+7
View File
@@ -215,3 +215,10 @@
if (!defined('USE_CAPTCHA')) {
define('USE_CAPTCHA', true);
}
/**
* Флаг использования защиты от DDoS
*/
if (!defined('USE_DDOS_PROTECTION')) {
define('USE_DDOS_PROTECTION', false);
}
@@ -94,7 +94,7 @@
$DB = DB::getInstance();
$item = $DB->getItem(self::TABLE, ['observed_key' => $this->observedKey]);
if ($item) {
if ($item['attempts'] >= $item['attempts_limit'] && (time() - $item['last_active']) <= $item['time_interval']) {
if (USE_DDOS_PROTECTION && $item['attempts'] >= $item['attempts_limit'] && (time() - $item['last_active']) <= $item['time_interval']) {
echo '<div style="color: #b30000;background: #ffe2e2;padding: 10px;border: 1px solid #ffa0a0;margin: 10px;display: inline-block;">';
echo '<span style="font-weight:bold; font-size: 1.1em;">You are temporarily blocked (DDoS Guard))</span><br>';
echo 'Due to a large number of requests, you are temporarily blocked.<br>If this happened by mistake, contact the resource administrator.<br>';