kevinbarker Posted September 9, 2006 Share Posted September 9, 2006 Hi all, still geting used to php!i have a quick question?I have certain menus for certain accress levels on my site that is controled via a MySQL database. in the file 300000.php there is a javescript menu! if i log in with access level 30000 i get this ok, if i login with access level 8000 i get the 30000 menu, any ideas.i have the following code after users have logged in.<?session_start();$acclevel = $_SESSION['AccLevel'];?> <?if (isset($_SESSION['valid_user'])) { if ($acclevel = 30000) { include '30000.php';//I WANT TO INCLUDE ANOTHER MENU HOW WOULD I DO THIS???? if ($acclevel = 8000) { include '8000.php';}else { echo "You are not logged in"; echo "<meta http-equiv=refresh content=3;url=/>";}?> Link to comment https://forums.phpfreaks.com/topic/20233-validate-user-to-display-a-certain-menu/ Share on other sites More sharing options...
tomfmason Posted September 9, 2006 Share Posted September 9, 2006 Ok you should do something like this. [code=php:0]if ($acclevel == 30000) { include("30000.php");}<-- You did not have this on your example. This will cause an unexpected $ on your last lineif ($acclevel == 8000) { include("8000.php");}[/code][b]=[/b] means that you are setting something to something like this [code=php:0]$var = 1;[/code]and [b]==[/b] is a comparsion. Hope this helps,Tom Link to comment https://forums.phpfreaks.com/topic/20233-validate-user-to-display-a-certain-menu/#findComment-88994 Share on other sites More sharing options...
kevinbarker Posted September 9, 2006 Author Share Posted September 9, 2006 THANK YOU!This gets the menu up, but some where it is not soring the login session?i have main.php, and i have menu.php in menu.php is the code above, in main.php i have <? include 'menu.php'; ?> i have set it to display echo "You are not logged in"; echo "<meta http-equiv=refresh content=3;url=/>";}wheni login it displays the menu, so that bit must be right, but then says i am not loged it, is it not saving the session some where? Link to comment https://forums.phpfreaks.com/topic/20233-validate-user-to-display-a-certain-menu/#findComment-89006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.