Entry
How can I detect in PHP whether a request originated via the browser's address or via a link ?
Jun 24th, 2004 12:04
Philip Olson, David Crossley,
Although not perfect you can check for the HTTP predefined variable
named HTTP_REFERER so for example:
if (isset($_SERVER['HTTP_REFERER'])) {
echo "Hi, you came from the link: " . $_SERVER['HTTP_REFERER'];
} else {
echo "Not sure where you came from!";
}
If you create the links yourself then you could do various things like
pass a variable via GET (in the URL) and check that, or, use a
SESSION, but most likely that's not your question.