sessionauthenticationusertype

$_SESSION['variable'] won't unset or change


$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') { ..... }

The else is not being reached.. Why please? Obviously I would also prefer TRUE or FALSE


Solution

  • change this line

    if ($UserType == 'read' OR 'edit' OR 'admin') {$_SESSION['Dashboard'] = 'YES';} 
    

    to

    if ($UserType == 'read' OR $UserType =='edit' OR $UserType =='admin') {$_SESSION['Dashboard'] = 'YES';}