fife Posted November 11, 2012 Share Posted November 11, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/270566-if-statement-failing/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 11, 2012 Share Posted November 11, 2012 (edited) 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 November 11, 2012 by PFMaBiSmAd Quote Link to comment https://forums.phpfreaks.com/topic/270566-if-statement-failing/#findComment-1391710 Share on other sites More sharing options...
fife Posted November 11, 2012 Author Share Posted November 11, 2012 (edited) Thanks PFMaBiSmAd Ill do that now Edited November 11, 2012 by fife Quote Link to comment https://forums.phpfreaks.com/topic/270566-if-statement-failing/#findComment-1391711 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.