I have this code right here:
if(isset($_SESSION['username'])) {
header("location: home.php");
exit();
}
This code works, but I want it to redirect to home.php with out having to visit a different page and then the page this code is on to trigger the code. I don't know how to do that. But for some reason it does not work how I want it to, because this only triggers when the person is logged in and then opens another tab on their browser an visits this page with the code to redirect them back to the home.php page, without having to go to another page and then to the page with this code again to make this code work.