Page 1 of 1

if condition

Posted: Sun Jan 18, 2004 2:41 pm
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

Posted: Sun Jan 18, 2004 2:51 pm
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

Posted: Sun Jan 18, 2004 3:03 pm
by vigge89
also, i advice you to use $_SESSION instead of $HTTP_SESSION_VARS, unless you got an older version.....

Posted: Sun Jan 18, 2004 5:35 pm
by vinny199
thanks a lot, yes, I was guessing but could't get the exact code. it makes sense now.

Cheers,

vinny