I had the following code at the top of a page thinking that it prevented the rest of the page from executing if the condition was met.
if(!$um->isLoggedinUser())
header('Location: index.php');
Obviously the simple solution would be to add an else clause such as…
if(!$um->isLoggedinUser()){
header('Location: index.php');
}
else{
//Execute the rest of the page
}
Or another option would be,
if(!$um->isLoggedinUser()){
header('Location: index.php');
die();
}
But I was surprised that the header function waited until the end of the page to work. Is that a configuration thing, or just the norm?