if (isset($_POST['submit'])) {
$email = $_POST['email'];
$pass = $_POST['password'];
$query = "select * from register where email = '".$email."'";
$select = mysqli_query($connect, $query);
$num = mysqli_num_rows($select);
if ($row = mysqli_fetch_assoc($select)) {
$dbpass = $row["password"];
//if (password_verify($pass, $dbpass)) {
# code...
if($num>0) {
$role = $row["role"];
if($role == "admin"){
// if ($num > 0 && $role == "admin") {
$_SESSION['username'] = $email;
$_SESSION['role'] = 'admin';
echo "hello student";
} else if ($num > 0 && $role == "student") {
$_SESSION['username'] = $email;
echo "hello student";
} else {
$_SESSION['status'] = "Invalid email address or password";
//header('Location:login.php');
}
}
}
else {
$_SESSION['status'] = "Email/password is invalid";
// header('Location:login.php');
}
}
THis is the login code i have used blowfish algorithm in it but it didnot doing well i dont know why because it is not giving me errors i think it is confusing in roles because i have and admin role teacher and student i want login according to rules that i have mentioned
I have tried to solve this issue i have followed the syntax from different tutorials as well as from php official documentation but still i am facing the problem of login now i want help from the legend developers THanks