This is a discussion on $_SERVER['HTTP_REFERER']; why doesn't it work?? within the PHP Language forums, part of the PHP Programming Forums category; Hi, I have a script using the $_SERVER['HTTP_REFERER'] var. I now installed php 5 and this function does not ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I have a script using the $_SERVER['HTTP_REFERER'] var. I now installed php 5 and this function does not work, 'undefined index' it says. Can anyone tell me what could be wrong? Thanks in advance, Maarten ps. this is not the same server as to which I refered in my other post. |
|
|||
|
Muffinman wrote:
> I have a script using the $_SERVER['HTTP_REFERER'] var. I now > installed php 5 and this function does not work, 'undefined index' it > says. Can anyone tell me what could be wrong? It won't be set if no referer information was passed by the browser. There are three circumstances I can think of when the referer information is not passed to the browser: 1) The user has typed the address into their browser, clicked a link in an email client, used a bookmark etc. The referer info will not be set as they have not been refered from another web page. 2) The user has a browser preference which prevents the referer information from being passed or uses proxy type software which prevents this from being passed. (Sometimes this software passes a referer url but if it does it's usually either the same as the requested page or the site's homepage and will be the same as they move from page to page). 3) It's a robot/spider or some script created by the user. These typically won't pass referer information as they move from page to page. (Some exceptions are spammy type bots which post a referer url back to their own site). -- Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/ |
|
|||
|
.oO(Tony Reed)
>... and it's not an "error," it's a "notice." The OP can either lower >his error-reporting level: > >error_reporting(E_ALL ^ E_NOTICE); Ignoring notices is bad style and may lead to errors that are hard to find. >or use isset() to check HTTP_REFERRER before trying to use it. That's how it should be. Micha |