prepare('SELECT * FROM ' . tn('users') . ' WHERE username = ? AND role IN (\'admin\', \'cs\')'); $stmt->execute([$u]); $row = $stmt->fetch(); if ($row && password_verify($pw, $row['password'])) { $_SESSION['admin_id'] = $row['id']; $_SESSION['admin_user'] = $row['username']; unset($_SESSION['csrf']); header('Location: index.php'); exit; } $err = '管理员账号或密码错误'; } ?>