Question about $HTTP_HOST, $HTTP_REFERER

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I made a web site using PHP Open sources for message board.
Everything's fine except one computer can't open a message writing

The code that gives an error is the following.

if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("Write in the normal way");

The browser is IE 6.0 and I configured the options the same as other

What's wrong?


Re: Question about $HTTP_HOST, $HTTP_REFERER

*** escribió/wrote (1 Feb 2005 08:53:56 -0800):
Quoted text here. Click to load it

Two remarks. First of all, the preferred way to call these variables is
using the $_SERVER array:


Secondly, there's most likely an ad-blocking software or firewall that
removes the referrer header from browser requests.

-+ Álvaro G. Vicario - Burgos, Spain
+- (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox

Re: Question about $HTTP_HOST, $HTTP_REFERER wrote:

Quoted text here. Click to load it

Possibly the HTTP_REFERER variable isn't being set. Is there something
on that computer which might be prevented the referal information being

As an aside, you are better to use the $_SERVER superglobal array like
so: $_SERVER['HTTP_HOST'] and $_SERVER['HTTP_REFERER'] as the use of
$HTTP_HOST etc has been deprecated.

You can never rely on $_SERVER['HTTP_REFERER'] being set so it is
generally unsafe to rely on it. There are browser preferences and other
3rd party apps that can prevent it being passed or otherwise altered.

When using HTTP_REFERER you are best to check it is first set with the
isset() function eg

if(isset($_SERVER['HTTP_REFERER'])) {
else {

Chris Hope - The Electric Toolbox - /

Site Timeline