Jump to content

validate user, to display a certain menu!


kevinbarker

Recommended Posts

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

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 line
if ($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
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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.