Tyl*_*erH -4 php privileges phpbb
我有一个带有基于 PHP 文件运行的集成包的 phpBB2 论坛。在这些文件之一中,可以通过以下方式确定可以访问特定页面的权限:
// only mods and admins will be able to see this control panel.
if ($userdata['user_level'] < ADMIN)
//message_die(GENERAL_ERROR,'No permission. If you are looking for the claims browser, it has been integrated into the forums.');
}
else
{
$mod_privileges = true;
$template->assign_block_vars("is_auth", array());
#$template->assign_block_vars("is_auth2", array());
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种方法来在这个 PHP 文件中为我们论坛上的特定用户添加权限(由他的帐户的用户 ID 标识,例如我们会说 9000),而不给他管理员或全局版主访问权限级别我们的 phpBB 论坛。
适当的改变会是这样吗?
// only mods and admins will be able to see this control panel.
if ($userdata['user_level'] < ADMIN) xor (&phpbb_user_id!==['9000'])
{
//message_die(GENERAL_ERROR,'No permission. If you are looking for the claims browser, it has been integrated into the forums.');
}
Run Code Online (Sandbox Code Playgroud)
我相信我已经想通了:
if ($userdata['user_id'] != 9000 && $userdata['user_level'] < ADMIN)
Run Code Online (Sandbox Code Playgroud)
这按预期工作。