$UserType = $row['UserType'];
$_SESSION['UserID'] = $row['UserID'];
//unset($_SESSION['UserType']);
$_SESSION['UserType'] = $UserType;
//unset($_SESSION['Dashboard']);
if ($UserType == 'read' OR 'edit' OR 'admin') {$_SESSION['Dashboard'] = 'YES';}
else {$_SESSION['Dashboard']='NO';}
if ($_SESSION['Dashboard'] == 'YES') { ..... }
其他没有达到..为什么请?显然我也更喜欢TRUE或FALSE
答案 0 :(得分:0)
更改此行
if ($UserType == 'read' OR 'edit' OR 'admin') {$_SESSION['Dashboard'] = 'YES';}
到
if ($UserType == 'read' OR $UserType =='edit' OR $UserType =='admin') {$_SESSION['Dashboard'] = 'YES';}
答案 1 :(得分:0)
您的if语句不正确。目前的代码基本上是比较$ UserType ==' ready'或者编辑'不是空的',或者管理员不是空的
你想:
if($ UserType ==' read' OR $ UserType ==' edit' OR $ UserType ==' admin')
答案 2 :(得分:0)
运行您的支票
if ( ($UserType == 'read') OR ($UserType =='edit') OR ($UserType =='admin') ) {
$_SESSION['Dashboard'] = 'YES';
}else {
$_SESSION['Dashboard']='NO';
}