password->password; if(password_verify($password, $hashedPassword )){ $_SESSION['groupName'] = $groupName; $_SESSION['groupId'] = $group->id; $_SESSION['success'] = "You are now logged in"; header('location: ../Frontend/index.php?login=success'); }else{ session_destroy(); header('location: ../Frontend/index.php?login=failed?reason=password'); } } else{ session_destroy(); header('location: ../Frontend/index.php?login=failed?reason=group'); } }