When the browser sends header info to the server, $_SERVER['HTTP_REFERER']
should give us the previous page URL right?
What returns from $_SERVER['HTTP_REFERER']
, when header info is not sent to server? empty string? false? null? or... ?
When the browser sends header info to the server, $_SERVER['HTTP_REFERER']
should give us the previous page URL right?
What returns from $_SERVER['HTTP_REFERER']
, when header info is not sent to server? empty string? false? null? or... ?
If the HTTP referer request header is not sent then the $_SERVER['HTTP_REFERER']
is probably not set, although it could be an empty string. Whether it is set or not in this case could depend on the server.
As with all HTTP request headers, check for its existence when reading:
$httpReferer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;