I created a function to assign the admin and user I use header location in this function to redirect the page to home if admin is not logged in but header(location:) is not working properly.
include_once 'function.php';
if( user_logged($conn) == "yes" && is_admin($conn) !="yes"){
echo "hello world";
header("Location: http://localhost/edirectory/home.php");
}else{
echo "no";
}