PDA

View Full Version : Hiding stuff in PHP?



Recursion
05-12-2006, 06:35 PM
Hello,

I have a Navigation menu and I am using the Techtuts user system (I know, I know its ****! but Im going to improve it, its just a baseline...).

How do I hide the Admin part of my Menu in my Navigation?

Thanks
Tom

omgDAN!
05-12-2006, 06:38 PM
if the user-level is admin then display the link.
don't know the code for techtuts system so can't post sorry.

Luckyrare
05-12-2006, 06:38 PM
if($usergroup = "admin"){
print("Admin bit");
}
Change variables and it will work

Recursion
05-12-2006, 06:41 PM
The database uses 'id' for user levels so would it be:


if($id = "5"){
print("Admin menu blah blah!");
}

nets
05-12-2006, 07:52 PM
You're using the wrong operator, it should be "==" rather than "=" to compare stuff.

Recursion
05-12-2006, 07:56 PM
so:



if($id == "5"){
print("Admin menu blah blah!");
}


?

San$
05-12-2006, 07:59 PM
It actually uses 'level', the ID is the member number if you like. Use



<?
ob_start();
include("config.php");
if ($logged[username]) { echo ("Members Stuff"); }
if ($logged[level] == "5") { echo ("Admin stuff"); }
?>

Recursion
05-12-2006, 08:03 PM
Oh yes, it is Level.

San, I like your code as it has members and admins. This will be used in my 1st DJ Panel (being made to help me learn PHP). I could also use your code to make it have an integrated news system so i could have news reporters that are non DJ.

Thanks for that San ;)

Want to hide these adverts? Register an account for free!