On my login system, I have it pop up in a fancyBox lightbox requested via AJAX. But there's one problem. If the user goes to login.php itself in their browser, they see an unstyled page that doesn't work because the JavaScript that helps it is on the page that has the login pop up. I want to redirect them to the homepage if they are on login.php.
I tried doing this:
<?php
if($_SERVER['REQUEST_URI'] == '/login.php') {
header("Location: /");
}
?>
As well as:
<?php
if($_SERVER['PHP_SELF'] == '/login.php') {
header("Location: /");
}
?>
Which both do not work because when you open up the fancyBox it messes up the page and makes it blank.
Is there a way to make it redirect if the user is at the login page itself that doesn't affect the fancyBox?