ss*@chol.net wrote:
I made a web site using PHP Open sources for message board.
Everything's fine except one computer can't open a message writing
page.
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
computer.
What's wrong?
Possibly the HTTP_REFERER variable isn't being set. Is there something
on that computer which might be prevented the referal information being
passed?
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 -
http://www.electrictoolbox.com/