Jump to content

If Statement Failing


fife

Recommended Posts

Ok I have a permission set in session. This permission can be 1,2,3. I have a page in which I echo the permission to make sure its correct. Currently when I view this page the permission is 1

 

at the top of the next page I have this

 


if($_SESION['per']!='1'){
$url = "/members/?permission=false";        
header("Location: $url"); 
}

 

for some reason the redirect is running when it shouldnt as the per is 1!! Not only that but I want to allow 2 to view this page too so the code would read...

 

 


if($_SESION['per']!='1' || $_SESION['per']!='2'){
$url = "/members/?permission=false";        
header("Location: $url"); 
}

 

but the first part isnt working so adding the other permission is pointless for now. Any ideas?

Link to comment
Share on other sites

You have a spelling error in your session variable. It's - $_SESSION

 

Do you have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you by reporting and displaying all the errors it detects. You will save a TON of time.

 

Your second test, with two conditions, would need to use an and comparison operator &&

Edited by PFMaBiSmAd
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.