[*] симпатишное сообщение о том что ты в бане

This commit is contained in:
rsgrinko committed 2023-10-07 00:01:21 +03:00
1 parent 8d64addc17
commit d47f2d0034
1 file changed
+6 -1
@@ -23,6 +23,7 @@
namespace Core\Helpers;
use Core\CoreException;
use Core\DataBases\DB;
/**
@@ -94,7 +95,11 @@
$item = $DB->getItem(self::TABLE, ['observed_key' => $this->observedKey]);
if ($item) {
if ($item['attempts'] >= $item['attempts_limit'] && (time() - $item['last_active']) <= $item['time_interval']) {
die('DDoS protected active');
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>';
echo '</div>';
die();
}
$DB->update(self::TABLE, ['id' => $item['id']], ['attempts' => ++$item['attempts'], 'last_active' => time()]);