$_SERVER['HTTP_REFERER']; why doesn't it work??

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-19-2004
Muffinman
 
Posts: n/a
Default $_SERVER['HTTP_REFERER']; why doesn't it work??

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.

Reply With Quote
  #2 (permalink)  
Old 12-19-2004
Chris Hope
 
Posts: n/a
Default Re: $_SERVER['HTTP_REFERER']; why doesn't it work??

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/
Reply With Quote
  #3 (permalink)  
Old 12-20-2004
Michael Fesser
 
Posts: n/a
Default Re: $_SERVER['HTTP_REFERER']; why doesn't it work??

.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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:31 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0