Im trying to make it so that if admin log on, "hello admin" is displayed and if a normal user logs on "hello user" is displayed. I have a user database containing username, password and usertype.
Everything works fine with the login, however it isnt displaying the correct messages depending on user input. I want to get this bit working, before i create a redirect which will redirect users to the user page and admin to the admin page.
Is there a better way to do this?
if ($userRecord["Userid"] > 0) {
$currentUser = $userRecord["Userid"];
if (!$_POST['password'] == $CurrentUser["password"]) {
$_SESSION["strValidUser"] = $_POST['username'];
if ($CurrentUser["UserType"] == "administrator") {
echo "hello admin";
} else {
echo "hello user";
};
} else {
echo "<DIV class=\"ERROR\">Sorry, unable to login. Please check your user name and password.<BR></DIV> \n";
$blnHitError = true;
};
} else {
echo "<DIV class=\"ERROR\">Sorry, unable to login. Please check your user name and password.<BR></DIV> \n";
$blnHitError = true;
};