473,729 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_REF ERER)) 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 5636
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_REF ERER)) 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($_SERV ER['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_REF ERER)) 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
9561
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 this I received over 100,000 Hits in less then one hour and it caused my host's server farm to crash. While I understand that I could move to a more robust Web Host, I would rather trap any further links from FARK and redirect them to a rejection...
1
2742
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 $_server and this output anything if the last link is on same server of my page but don't from anyother server.
2
1668
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 Login.asp page it lets them in. When our users login to go to the other site, they login on our site's Login.asp page. When they click submit, our LoginCheck.asp page validates them and does a response.redirect to the other site. In most cases...
4
5293
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. Anyway, we're using the mm_menu javascript menu for our web menus, and under only Internet Explorer it's not passing the http_referer -- which means any site of theirs we link to from the menu doesn't work. This works fine in Firefox, Mozilla, and...
28
4883
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 referrer URL. How Do I get that? I know about Request.ServerVariables("HTTP_REFERER"). So I used this in
1
5465
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 server variables return the server names of domains that are completely unrelated to the hosting website??? I know, it's not supposed to work that way, but it is. I'm seeing almost 30,000 accesses/day on an empty website, no less!
2
1336
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 characters give a bad impression to the search engines and feeds. can you tell me what is the code to be written in .htaccess.. is it the same we do in regular expression.. my URL is like http://domain.com/view.php?action=read&id=8
7
3035
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 the HTTP_HOST value is of course "www.mydomain.com". But sometimes it is: "www.mydomain.com, www.mydomain.com". Is that supposed to be a correct behabior??
7
24595
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 of PHP. Apache version 1.3.37 PHP version 5.2.4 I'm currently searching for an upgrade to Apache.
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.