As my site is set up now when the user is logged out they only see a login and register link in a drop down menu, however, when they login they see member links in the menu as shown below (condensed):
Code: Select all
<?php
session_start();
$toplinks = "";
if (isset($_SESSION['id'])) {
$userid = $_SESSION['id'];
$username = $_SESSION['username'];
$toplinks = '<li><a href="members.php">Member Zone</a>
<ul>
<li><a href="upgrade.php">Upgrade Membership</a></li>
<li><a href="buy.php">Buy Credits</a></li>
</ul>
</li>';
} else {
$toplinks = '<li><a href="members.php">Members</a>
<ul>
<li><a href="register.php">Register</a></li>
<li><a href="login.php">Login</a></li>
</ul>
</li>';
}
?>
Pretty simple and does exactly what I want it to do but now onto the problem. I'm adding multiple account types that will display different links. ie. links for a basic member, links for a paying member, links for admin, etc... The links displayed in the drop down menu will depend on the account type currently logged in. Something like the following:
Code: Select all
if ($accounttype=="a"){
$toplinks = '<li>links 1</li>';
} else if ($accounttype=="b"){
$toplinks = '<li>links 2</li>';
} else if ($accounttype=="c"){
$toplinks = '<li>links 3</li>';
} else {
$toplinks = '<li>standard links</li>';
}
I'm having difficulty getting this to work the way I want it to. So how can I wrap this up in a neat package without making huge changes? I hope I've been clear. Please ask me if you need additional details.