0

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"];

halfer
  • 19,824
  • 17
  • 99
  • 186
Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145
  • why put the session value in the url? why not just read the session? could be a major security issue –  Feb 27 '17 at 20:43
  • 3
    instead of `"Location: initial_admin_manage.php?id='.$_SESSION['LasCrusesUserID'].'"`, use `"Location: initial_admin_manage.php?id=".$_SESSION['LasCrusesUserID']` You have a quotes mixup! – castis Feb 27 '17 at 20:43
  • 4
    Possible duplicate of [What is the difference between single-quoted and double-quoted strings in PHP?](http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php) – castis Feb 27 '17 at 20:44
  • thank you to all, specially to @castis – Tiago Martins Peres Feb 27 '17 at 20:48

1 Answers1

1

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).

Louis Loudog Trottier
  • 1,367
  • 13
  • 26