I have a PHP user authentication script, but it isn't functioning properly. I am trying to perform the following:
- Return to login page if the session variable "expires" is in the past, or if the user is neither an administrator, nor is logged in.
Else set the session variable "expires" to time() + 300 and redirect to the home page.
$case1 = (isset($_SESSION["expires"]) && $_SESSION["expires"] > time()); $case2 = ($_SESSION["user_id"] == "ADMIN" || $_SESSION["user_id"] != ""); $case3 = (isset($_SESSION["user_id"]) && (case2)); if (case1 || case3) { // redirect to home page } else // redirect to login page