Home › Forums › Back End › Controlling Navigation with PHP Depending on User? › Re: Controlling Navigation with PHP Depending on User?
September 27, 2009 at 12:15 pm
#64758
Member
Yeah that solution seems to be very logical. You might want to consider storing the variable in a PHP session, so that you can reuse it. The best way would be to have the logical expression (the if statement) on the login page, and then a variable is set that contains the path of the navigation, so…
Code:
if($usergroup == 1)
{
$_SESSION[‘nav-path’] = “nav/nav1.php”;
}
else
{
$_SESSION[‘nav-path’] = “nav/nav2.php”;
}
{
$_SESSION[‘nav-path’] = “nav/nav1.php”;
}
else
{
$_SESSION[‘nav-path’] = “nav/nav2.php”;
}
And then when your user visits a page…
Code:
This solution will make it more manageable in the long run. Hope this helps.
-Tom