Different Menu Depending on UserName

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ardan16
Forum Commoner
Posts: 32
Joined: Fri Aug 01, 2008 6:07 am

Different Menu Depending on UserName

Post by ardan16 »

Hi all,
This is my first post and having problems with some php concepts.
If I have a login form and sessions are set so it remembers the name.
How can I have an if statement to change the menu that is displayed.
Eg

Code: Select all

if $_SESSION['username'] = 'admin'{
or because of the following code do I need to check username and password

if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookpass'])){
$_SESSION['username'] = $_COOKIE['cookname'];
$_SESSION['password'] = $_COOKIE['cookpass'];
}

do they both need to be checked or is the if statement wrong

Cheers
ody3307
Forum Newbie
Posts: 21
Joined: Wed Jul 30, 2008 7:29 am

Re: Different Menu Depending on UserName

Post by ody3307 »

You'll need to wrap that if statement in parenthesis
if(blah == blah) {do something;}
ardan16
Forum Commoner
Posts: 32
Joined: Fri Aug 01, 2008 6:07 am

Re: Different Menu Depending on UserName

Post by ardan16 »

Thanks Ody
Post Reply