473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question about $HTTP_HOST, $HTTP_REFERER

ssk
Hello!

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?

TIA.
Sam

Jul 17 '05 #1
2 5605
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/
Jul 17 '05 #2
*** ss*@chol.net escribió/wrote (1 Feb 2005 08:53:56 -0800):
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");


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

$_SERVER['HTTP_HOST']
$_SERVER['HTTP_REFERER']

Secondly, there's most likely an ad-blocking software or firewall that
removes the referrer header from browser requests.
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (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
--
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John A. Irwin | last post by:
I'm very new to PHP and am trying to figure out how to parse out a variable "HTTP_REFERER". My reason for this is my site was recently "FEATURED" (sic) on a website called FARK.COM. Because of...
1
by: Sebastien | last post by:
hi, all i need your help, on about http_referrer in my script. when a visitor comes from another server i whish intercept the url where he come from; i've made some test with a simple echo...
2
by: M Smith | last post by:
On our web site we allow our members access to features hosted by another web site. The way the other web site authenticates users is to check the value of the HTTP_REFERER. If it comes from our...
4
by: Ringo Langly | last post by:
Hi everyone, We're using an outside vendor to provide some content for our website, and they use the http_referer variable to verify their content is only viewed from subscribing customers. ...
28
by: Prabhat | last post by:
Hello, I have the below requirement. When ever my website is opened by any link: say clicked from the google search result or a link from other website: Then I should able to know the...
1
by: Bill | last post by:
These two server variables should ALWAYS return the domain name of the host: - Request.ServerVariables("SERVER_NAME") - Request.ServerVariables("HTTP_HOST") Under what circumstances can those...
2
realin
by: realin | last post by:
I have posted this question in apache forum, but no one replied, i guess it isnt this much happening as PHP forum is :P hi guys, i want to use URL writing now, cause the other weird...
7
by: Hermann | last post by:
I run a server with apache 1.3 and php 5. Yesterday I notice that sometimes the HTTP_HOST server variable has a comma separated list in it. Let's say my domain name is: www.mydomain.com Usually...
7
by: JC | last post by:
Undefined index: HTTP_HOST This occurs sometimes, is there a reliable method for determining the HTTP_HOST. Not sure if this is something related to Apache or if it's a problem with the version...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.