tiago peres tiago peres -4 years ago 137
PHP Question

Event After Succesful Login PHP

Having a problem that has to do with the following script:

if ($getUserType == "Admin") {
header("Location: overall_lascruses_users_list.php");
exit();
} elseif ($getUserType == "LCLEmployee") {
header("Location: overall_lascruses_users_list.php");
exit();
} elseif ($getUserType == "Site_Admin") {
header("Location: initial_admin_manage.php?id='.$_SESSION['LasCrusesUserID'].'");
exit();
} elseif ($getUserType == "Site_Manager" || $getUserType == "Site_User") {
header("Location: Control_Panel_list.php");
exit();
}


How this works is the following:


after a user logs in, it picks up the user role and then
redirects to a different screen accordingly to its role.


The script was working fine, until it was added the following part:

header("Location: initial_admin_manage.php?id='.$_SESSION['LasCrusesUserID'].'");


What is wrong here?

Note:
$_SESSION["LasCrusesLocal_UserID"] = $data["lasCrusesUserID"];

Answer Source

This:

header("Location: initial_admin_manage.php?id='.$_SESSION['LasCrusesUserID'].'");

should look like this:

header("Location: initial_admin_manage.php?id=".$_SESSION['LasCrusesUserID']);

Seee the single, double quotes in phph they don't act the same

You can put a var inside double quote and it will be treated as his var itself but not in single quotes (in most case anyway, depend on your config).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download