This topic is locked

Redirect after login dependant on "Default" group

11/17/2009 05:36:41
PHPRunner General questions
M
mmponline author

This code was provided in a locked post for directing to a page on login depending on the user group. What GroupID can be used if the group is Default. I tried Default with no effect

if ($_SESSION["GroupID"]=="user")

{

header("location: anypage.php");

}
J
Jane 11/17/2009

Hi,
<Deafult> group means that group for this user is not set, I.e.

if ($_SESSION["GroupID"]=="admin")

{

//admin group

header("location: anypage1.php");

}

elseif ($_SESSION["GroupID"]=="user")

{

//user group

header("location: anypage2.php");

}

else

{

//default group

header("location: anypage1.php");

}
M
mmponline author 11/18/2009

Jane
My code:

if ($_SESSION["GroupID"]=="Admin")

{

//admin group

header("location: menu.php");

}

elseif ($_SESSION["GroupID"]=="Users")

{

//user group

header("location: classifiedsAdmin_list.php");

}

else

{

//default group

header("location: ClassifiedsUsers_list.php");

}


If I add to the after successful login (Login Page event), nothing happens, all still goes to the menu page.
If I add it to the after processing on the Menu page event, it works for both default and Users but Admin just takes ages to load without anything happening (having to go to menu.php page)
If I remove the Admin part of the code:

if ($_SESSION["GroupID"]=="Users")

{

//user group

header("location: classifiedsAdmin_list.php");

}

else

{

//default group

header("location: ClassifiedsUsers_list.php");

}


Admin does not go to the menu but to the same pages as Default.
Please assist.