if condition

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
vinny199
Forum Newbie
Posts: 8
Joined: Sun Nov 16, 2003 12:58 pm
Location: London

if condition

Post by vinny199 »

Hi,

still struggling with if condiitons.

I'm trying to do the following:

if $HTTP_SESSION_VARS['MM_UserAuthorization']='admin'
then display link: <a href="MasterAccount.php">Account</a>

Basically, after the user has logged in, if his user authentification is admin, then display the link "Account" on the page.

Could you show me an example of code for doing that?

Thanks,

vinny
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

actually your problem isn't really clear since you almost wrote the whole code...

Code: Select all

<?php
if ($HTTP_SESSION_VARS["MM_UserAuthorization"] == "admin")
  echo "<a href="MasterAccount.php">Account</a>";
?>
probably you should read http://de2.php.net/manual/en/control-structures.php
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

also, i advice you to use $_SESSION instead of $HTTP_SESSION_VARS, unless you got an older version.....
vinny199
Forum Newbie
Posts: 8
Joined: Sun Nov 16, 2003 12:58 pm
Location: London

Post by vinny199 »

thanks a lot, yes, I was guessing but could't get the exact code. it makes sense now.

Cheers,

vinny
Post Reply