From 0e4d2f9334b6b70c33f42fffcc23e62c2d8816ce Mon Sep 17 00:00:00 2001 From: ypsdf1 Date: Wed, 28 Oct 2026 22:12:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC58=E6=89=B9=E7=BB=AD27=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9AcreditRequireAdmin=20session=E9=94=AE?= =?UTF-8?q?=E5=90=8D=E5=AF=B9=E9=BD=90=20core.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit credit.php 检查 admin_logged_in,但 core.php requireAdminSession() 实际用 admin_auth。 session 键名不一致导致管理员后台查积分/审批全部返回401。 --- api/credit.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/credit.php b/api/credit.php index 09e2be8..5534095 100644 --- a/api/credit.php +++ b/api/credit.php @@ -78,7 +78,9 @@ function creditRequirePlayer() { /** 管理端 session 校验 */ function creditRequireAdmin() { - if (empty($_SESSION['admin_logged_in']) || !$_SESSION['admin_logged_in']) { + if (session_status() === PHP_SESSION_NONE) session_start(); + // ★ 与 core.php requireAdminSession() 保持一致:admin_auth + if (empty($_SESSION['admin_auth']) || !$_SESSION['admin_auth']) { error('需要管理员权限', 401); } }