From 6d6fa82fcf238bbe7639b2aedf3736b4328b4043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Fri, 12 Dec 2025 12:39:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AF?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E3=81=97=E3=81=9F=E3=82=89=E3=82=82=E3=80=81?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=8C=E5=A4=B1=E6=95=97?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=82=89=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92?= =?UTF-8?q?=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Site/Controller/User.php | 10 +++++++--- util.php | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Site/Controller/User.php b/src/Site/Controller/User.php index f0055a4..c2a4898 100644 --- a/src/Site/Controller/User.php +++ b/src/Site/Controller/User.php @@ -41,9 +41,13 @@ class User { if (!$res->isSuccess) { $error = $res->message; } else { - $auth->setToken($a[0], $a[1]); - header('Location: /'); - exit(); + $result = $auth->setToken($a[0], $a[1]); + if (!$result->isSuccess) { + $error = $result->message; + } else { + header('Location: /'); + exit(); + } } } $tmpl = new Template('/'); diff --git a/util.php b/util.php index 65d38a3..85d0ae8 100644 --- a/util.php +++ b/util.php @@ -113,9 +113,9 @@ function to_money($amount, $lang) { } function randstr(): string { - srand(floor(time() / (60*60*24))); - $len = rand() % 20; - return bin2hex(random_bytes($len / 2)); + srand((int)floor(time() / (60*60*24))); + $len = rand(1, 20); + return bin2hex(random_bytes($len)); } function assert_null(mixed $assertion, Throwable|string|null $description = null): bool {