Jump to content
Larry Ullman's Book Forums

msacomputers

Members
  • Posts

    1
  • Joined

  • Last visited

msacomputers's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I am working on a registration/login site. If the user's login is successful from my login.php page, I have a redirect to a loginsuccess.php page. From this page I need help setting up four different redirects based on user levels (0, 1, 2, 3). I’ve started with the following code, but no matter what the level of the user, my page redirects to hurray.php. How can I get this script to look at the user level in the database (my field is named user_level in my table) and how can I add multiple redirects to this page? $_SESSION['user_level'] = (int) $_SESSION['user_level']; // Changes the 1 or 2 user level to an integer. $url = ($_SESSION['user_level'] === 0) ? ‘hurray.php’: ‘index.php'; // Ternary operation to set the URL header('Location: ' . $url); // Makes the actual page jump. Keep in mind that $url is a relative path. exit(); // Cancels the rest of the script. My second question is why are two .php files listed in $url = ($_SESSION['user_level'] === 0) ? ‘hurray.php’: ‘index.php'; // ? Is the first what it goes to if successful, the second if it is not? Thanks so much for your assistance! Been stumped on this for awhile.
×
×
  • Create New...