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
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
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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