Page 1 of 1

Different Menu Depending on UserName

Posted: Fri Aug 01, 2008 6:22 am
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

Re: Different Menu Depending on UserName

Posted: Fri Aug 01, 2008 6:42 am
by ody3307
You'll need to wrap that if statement in parenthesis
if(blah == blah) {do something;}

Re: Different Menu Depending on UserName

Posted: Fri Aug 01, 2008 7:24 pm
by ardan16
Thanks Ody