[*] симпатишное сообщение о том что ты в бане
This commit is contained in:
1 parent
8d64addc17
commit
d47f2d0034
1 file changed
+6
-1
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace Core\Helpers;
|
namespace Core\Helpers;
|
||||||
|
|
||||||
|
use Core\CoreException;
|
||||||
use Core\DataBases\DB;
|
use Core\DataBases\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,7 +95,11 @@
|
|||||||
$item = $DB->getItem(self::TABLE, ['observed_key' => $this->observedKey]);
|
$item = $DB->getItem(self::TABLE, ['observed_key' => $this->observedKey]);
|
||||||
if ($item) {
|
if ($item) {
|
||||||
if ($item['attempts'] >= $item['attempts_limit'] && (time() - $item['last_active']) <= $item['time_interval']) {
|
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()]);
|
$DB->update(self::TABLE, ['id' => $item['id']], ['attempts' => ++$item['attempts'], 'last_active' => time()]);
|
||||||
|
|||||||
Reference in new issue
Block a user