Jump to content


Photo

validate user, to display a certain menu!


  • Please log in to reply
2 replies to this topic

#1 kevinbarker

kevinbarker
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 September 2006 - 05:24 PM

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=/>";
}
?>

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 09 September 2006 - 05:30 PM

Ok you should do something like this.

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");
}

= means that you are setting something to something like this
$var = 1;

and == is a comparsion.


Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 kevinbarker

kevinbarker
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 September 2006 - 05:52 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users