【问题标题】:What is the best way to redirect users where there are admins and regular users?在有管理员和普通用户的地方重定向用户的最佳方式是什么?
【发布时间】:2020-02-02 20:23:24
【问题描述】:

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

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

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

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

【问题讨论】:

  • 任何答案都可以解决问题或有帮助吗?什么没有按照你想要的方式工作?有什么工作吗?问题不清楚。

标签: php html mysql redirect


【解决方案1】:

为什么需要计数器?

你可以简化如下:

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

【讨论】:

    猜你喜欢
    • 2021-08-10
    • 2014-06-01
    • 2013-06-30
    • 2012-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-08
    相关资源
    最近更新 更多