dual_alliance Posted August 12, 2006 Share Posted August 12, 2006 Ok well l have this code:[code=php:0]<?phpsession_start();// Has the user logged in? if(!isset($_SESSION['username'])){ echo 'You are not logged in!'; // Quit the code so they can't view anything else! exit; } $accessLevel = $_SESSION['alevel']; // Does the user have admin previlages? if("$accessLevel" !== 9){ echo 'You do not have permission to access the admin control panel!'; }else{ [/code]Before you ask sessions are working as l have the print_r function on the session to make sure its working and it prints out:InArray ( [userid] => 8 [username] => dual_alliance [alevel] => 9 ) So l'm not sure why its not working. Could anyone shed some light on this ?Thanks,dual_alliance Quote Link to comment Share on other sites More sharing options...
newb Posted August 12, 2006 Share Posted August 12, 2006 usergroup levels are done in sessions? i thought they were done in bitwise? Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 12, 2006 Author Share Posted August 12, 2006 Well l'm making a CMS system so l'm going to have like:9 = Admin1 = Guest2 = Validatingetc....And l have the usergroup as 9 and its being compared to the number 9 so why won't it work ??? And also when they login l have it so all the static MySQL data in the database is made into sessions. Quote Link to comment Share on other sites More sharing options...
newb Posted August 12, 2006 Share Posted August 12, 2006 i think you can only do usergroups in bitwise dude Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 12, 2006 Author Share Posted August 12, 2006 Dude like what are you on?!? You have just been posting useless coments!I fixed it myself. And you [b]dont[/b] need bitwise!I just had to change [code=php:0]!==[/code] to [code=php:0]!=[/code] and now it works. Quote Link to comment Share on other sites More sharing options...
newb Posted August 13, 2006 Share Posted August 13, 2006 k asshole was just trying to help, someone told me u can only do them in bitwise so thats why i said that >_>. no need to be a cockfag about it. if it was that easy then next time fuck off and dont post for help. Quote Link to comment Share on other sites More sharing options...
elhama Posted August 13, 2006 Share Posted August 13, 2006 [quote author=dual_alliance link=topic=104023.msg414722#msg414722 date=1155417631]Ok well l have this code:[code=php:0]<?phpif("$accessLevel" !== 9){ echo 'You do not have permission to access the admin control panel!'; }else{ [/code][/quote]I think you forgot an exit; right after the echo, you could rather try using die("You do not have permission to access the admin control panel!");Try doing it this way[code=php:0]<?phpif ($accessLevel != 9) { die("You do not have access to the admin panel!");}?>[/code] Quote Link to comment 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.