samedi 11 mai 2019

How to do if-statement for a three type user login?

I have a log in system which I'm working on right now. It had a two typer user Login but now I'm trying to add a third type user but I'm having trouble with "if statements". The part where it redirects to location accordingly to the user type I want to add a "Judge" user so it should go to "login_judge.php". But I can't seem to work the extra "if".

if (mysqli_num_rows($results) == 1) { 

        $logged_in_user = mysqli_fetch_assoc($results);
        if ($logged_in_user['user_type'] == 'admin') {
            $_SESSION['user'] = $logged_in_user;
            $_SESSION['success']  = "Success";
            header('location: login_admin.php');
        }else{
            $_SESSION['user'] = $logged_in_user;
            $_SESSION['success']  = "Success";
            header('location: login_user.php');
                }
         }else {
        array_push($errors, "User and Password don't match");
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire