温馨提示:本文翻译自stackoverflow.com,查看原文请点击:php - What is the best way to redirect users where there are admins and regular users?
html mysql php redirect

php - 将用户重定向到有管理员和普通用户的最佳方法是什么?

发布于 2020-04-13 11:46:29

我有一个拥有管理员用户的CMS环境,我需要一种方法来重定向不是管理员或不拥有他们要编辑的文档的用户。看起来像这样,但是我的管理员无法以这种方式访问​​该页面,不确定为什么:

$cannotpass=0;
if ($reportsusername != $usersusername) {
    $cannotpass++;
}

if ($usersadmin != $admin) {
    $cannotpass++;
}   

if ($cannotpass >= 1) {
    header("location:http://decibeldesignstudios.com/blackbirdsecurity/adminlanding");  
}

查看更多

提问者
Dustin
被浏览
45
technophyle 2020-02-03 04:33

为什么需要柜台?

您可以将其简化如下:

if ($reportsusername != $usersusername && $usersadmin != $admin) {
    header("location:http://decibeldesignstudios.com/blackbirdsecurity/adminlanding");  
}