How do I check for a specific user ID in phpBB2 when executing an IF xor ELSE statement in a php file

StackOverflow https://stackoverflow.com/questions/18670556

  •  28-06-2022
  •  | 
  •  

I have a phpBB2 forum with an integrated package that runs based on PHP files. In one of these files, privileges for who can access a certain page are determined this way:

// 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());
}

And I am looking for a way to add in permission for a specific user on our forum (identified by his account's user ID, we will say 9000 for example) in this PHP file, without giving him access levels of Administrator or Global Moderator access on our phpBB forums.

Would an appropriate change be something like this?

// 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.');
}
有帮助吗?

解决方案

I believe I've figured it out:

if ($userdata['user_id'] != 9000 && $userdata['user_level'] < ADMIN)

This works as intended.

其他提示

Your condition will be

if ($userdata['user_level'] < ADMIN) || ($phpbb_user_id!=='9000') {

}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top