Forum Moderators: phranque

Message Too Old, No Replies

www. Missing From getenv('HTTP_REFERER')

Problem with PHP mail filtering script that checks referring page.

         

cohoho

5:45 pm on Dec 8, 2005 (gmt 0)

10+ Year Member



Greetings. I am trying to figure out what circumstances would cause the PHP variable getenv('HTTP_REFERER') to be missing "www." from the referring URL. In my PHP form mail script, one of the filtering functions checks to ensure that an error is triggered if the script is called from any page other than the one that it should be called from. In a few cases, an error has been logged because the referring page is "http://mydomain.com/feedback.php" rather than "http://www.mydomain.com/feedback.php".

Does this raise any flags or should I just modify the script to ignore that part of the referring URL? Any advice or guidance is appreciated. Thanks.

kaled

6:03 pm on Dec 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Modify the script so that www. is optional.

Having said that, users may switch off referrer data - what happens then?

Also, if this is a security feature, bear in mind that referrer data can be spoofed.

Kaled.

physics

6:34 pm on Dec 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi cohoho, welcome to WebmasterWorld.com!

The reason is probably that some people are typing in yourdomain.com instead of www.yourdomain.com. You can redirect people from yourdomain.com to www.yourdomain.com with Apache config files (if you're on Apache).

cohoho

6:51 pm on Dec 8, 2005 (gmt 0)

10+ Year Member



Many thanks kaled and physics for the quick and helpful responses. Great forum. Cheers.