ivalea Posted February 28, 2006 Share Posted February 28, 2006 Hi - I'm sortof a newb when it comes to PHP and I'm trying to build a site that offers two account types. I also have pages that I want to restrict access to depending if they have an account type of 1 or 2. I am having some trouble with the if statement that would not only check to see if the user is logged in, but logged in with a certain account type. This is what I have:if(empty($_SESSION[user1])){ include_once("lerr.php"); }My question is how to I get it to say if user is logged in AND account type = 1 then direct them to the page otherwise show the lerr.php page.I hope I've explained this correctly. Any help would be greatly appreciated - I've spent way too much time on this one. :)Thanks!ivalea Quote Link to comment https://forums.phpfreaks.com/topic/3763-help-wconditional/ Share on other sites More sharing options...
soccer022483 Posted February 28, 2006 Share Posted February 28, 2006 how about[code]if(isset($_SESSION['user1']) && $_SESSION[user1_account_type] == 1) { //page output}else { require_once 'lerr.php';}[/code]I'm assuming if user1 is logged in, you set $_SESSION[user1] equal to true or something, otherwise you don't set it to anything. I'm not sure if I answered you correctly or not. Quote Link to comment https://forums.phpfreaks.com/topic/3763-help-wconditional/#findComment-13077 Share on other sites More sharing options...
ivalea Posted February 28, 2006 Author Share Posted February 28, 2006 Thanks soccer for your reply... unfortunately this was what I thought to be the logical solution and tried it first but it didn't work. I finally did get it to work though by adding a separate if to the page directly. So the main access page just checks to see if they are logged in and then passes them onto the page and then checks to see what type of account they have. Maybe not the best solution, but it works! :)Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/3763-help-wconditional/#findComment-13150 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.