BOT対策
This commit is contained in:
45
util.php
45
util.php
@@ -44,6 +44,46 @@ function kys(mixed $arg): void {
|
||||
die();
|
||||
}
|
||||
|
||||
function ffs(): void {
|
||||
echo '<style>html { color: #fcfcfc; background-color: #232023; } body { margin: 0; }</style>';
|
||||
echo '<header style="padding: 10px 0; display: flex; justify-content: space-evenly; background-color: #b61729; margin-bottom: 20px; position: sticky; top: 0;"><div><b>F</b>OR</div> <div><b>F</b>UCKS</div> <div><b>S</b>AKE</div></header>';
|
||||
|
||||
$stack = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 50);
|
||||
$st = [];
|
||||
unset($stack[0]);
|
||||
$i = 0;
|
||||
|
||||
echo '<pre>';
|
||||
print_r($stack);
|
||||
echo '<pre>';
|
||||
foreach ($stack as $s) {
|
||||
if (isset($s['file'])) $st[$i]['file'] = $s['file'].(isset($s['line']) ? ':'.$s['line'] : '');
|
||||
else $st[$i]['file'] = '';
|
||||
if (isset($s['function'])) $st[$i]['func'] = (isset($s['class']) ? $s['class'].(isset($s['type']) ? $s['type'] : '::') : '').$s['function'];
|
||||
else $st[$i]['func'] = '';
|
||||
if (isset($s['object'])) $st[$i]['objs'] = $s['object'];
|
||||
else $st[$i]['objs'] = new \stdClass;
|
||||
if (isset($s['args'])) $st[$i]['args'] = $s['args'];
|
||||
else $st[$i]['args'] = [];
|
||||
$i++;
|
||||
}
|
||||
unset($stack[$i]);
|
||||
|
||||
foreach ($st as $s) {
|
||||
echo '<div>';
|
||||
echo '<b>ファイル:</b>';
|
||||
echo $s['file'].'<br />';
|
||||
echo '<b>関数:</b>';
|
||||
echo $s['func'].'<br />';
|
||||
echo '<b>オブジェクト:</b>';
|
||||
echo print_r($s['objs']).'<br />';
|
||||
echo '<b>その他:</b>';
|
||||
echo print_r($s['args']).'<br />';
|
||||
echo '</div>';
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
function base58btc_encode(string $bin): string {
|
||||
$a = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||
$base = 58;
|
||||
@@ -113,8 +153,7 @@ function to_money($amount, $lang) {
|
||||
}
|
||||
|
||||
function randstr(): string {
|
||||
srand((int)floor(time() / (60*60*24)));
|
||||
$len = rand(1, 20);
|
||||
$len = random_int(1, 20);
|
||||
return bin2hex(random_bytes($len));
|
||||
}
|
||||
|
||||
@@ -178,7 +217,7 @@ if (AUTH_ENABLED) {
|
||||
}
|
||||
|
||||
function verify_csrf_token(string $token): bool {
|
||||
return hash_equals(getcookie('csrf_token'), $token);
|
||||
return null !== getcookie('csrf_token') && hash_equals(getcookie('csrf_token'), $token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user