i'm working on a login page. certain pages require login and redirect like this:
if ($not_logged_in) {
header("Location: login.php");
}
in the login page, i want to do something like
if ($login_successful) {
header("Location: " . $_SERVER['HTTP_REFERER']);
}
but i have found that redirecting using header sometimes means that http_referer is empty.
do you have to click a link for http_referer to be set? if not, i will need to specify in each and every page that requires login which page needs to be returned to.