473,545 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to use $_SERVER['HTTP_REFERER']

Jez
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?

Thanks!

Jez
Jul 17 '05 #1
9 30884
On Mon, 06 Oct 2003 23:56:31 -0700, Jez wrote:
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?


Have you tried adding a quick phpinfo(); to your script to make sure that
the hosting web server is actually providing the referer information?

/Ant

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 17 '05 #2
Jez
je**********@bt internet.com (Jez) wrote in message news:<ad******* *************** ****@posting.go ogle.com>...
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?

Thanks!

Jez


The reason I ask is that I've created a 'send to friend' page which
obviously needs to know the url of the referring page.

I've found a solution, but I'm unsure whether it's ok to use:

Rather than use $_SERVER['HTTP_REFERER'] on the 'send to friend' page,
I've used send.php?page=h ttp://$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
in the link on the referring page.

It works, and although it's not the best solution is it a good one?

Jez
Jul 17 '05 #3

On 6-Oct-2003, je**********@bt internet.com (Jez) wrote:
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?


The browser may choose not to provide referer information.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #4

"Jez" <je**********@b tinternet.com> wrote in message
news:ad******** *************** ***@posting.goo gle.com...
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?

Thanks!

Jez


The browser might not provide HTTP_REFERER so you cannot rely on it -
Secondly, some software firewalls (like Norton Internet Security) have
features to strip out such information... It might work on your local server
if your local server is also your client....
Jul 17 '05 #5
"Jez" <je**********@b tinternet.com> wrote in message
news:ad******** *************** ***@posting.goo gle.com...
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?


Just print it out to the browser:

print '<pre><xmp>';
print_r($_SERVE R);
print '</xmp></pre>';

and you see which keys are defined inside $_SERVER @ your hoster.

regards

timo

Jul 17 '05 #6
Jez wrote:
je**********@bt internet.com (Jez) wrote in message news:<ad******* *************** ****@posting.go ogle.com>...
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?

Thanks!

Jez

The reason I ask is that I've created a 'send to friend' page which
obviously needs to know the url of the referring page.

I've found a solution, but I'm unsure whether it's ok to use:

Rather than use $_SERVER['HTTP_REFERER'] on the 'send to friend' page,
I've used send.php?page=h ttp://$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
in the link on the referring page.

It works, and although it's not the best solution is it a good one?


That's about as reliable as you're gonna get. Not all browsers/web
servers provide referer info, and still others allow you to set it to
whatever you want.

That said, you may not want to provide the entire URL to the send.php
script. Use only the REQUEST_URI, and put that in a session variable
instead of a get request. Not doing these things may cause you pain when
spammers see how easy it will be to use your script for themselves...

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 17 '05 #7
Jez
Anthony Whitehead <an************ ***@rfv.sfa.se> wrote in message news:<pa******* *************** ******@rfv.sfa. se>...
On Mon, 06 Oct 2003 23:56:31 -0700, Jez wrote:
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?


Have you tried adding a quick phpinfo(); to your script to make sure that
the hosting web server is actually providing the referer information?


Thanks.

Just tried it and it's not listed. Does that mean it's a server issue
rather than a PHP one?

Jez
Jul 17 '05 #8
Jez
je**********@bt internet.com (Jez) wrote in message news:<ad******* *************** ****@posting.go ogle.com>...
je**********@bt internet.com (Jez) wrote in message news:<ad******* *************** ****@posting.go ogle.com>...
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?

I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?

Thanks!

Jez


The reason I ask is that I've created a 'send to friend' page which
obviously needs to know the url of the referring page.

I've found a solution, but I'm unsure whether it's ok to use:

Rather than use $_SERVER['HTTP_REFERER'] on the 'send to friend' page,
I've used send.php?page=h ttp://$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
in the link on the referring page.

It works, and although it's not the best solution is it a good one?

Jez


Perhaps $_SERVER['SCRIPT_URI'] would be more appropriate?
Jul 17 '05 #9
"Timo Henke" <we*******@fli7 e.de> wrote in message
news:bl******** *****@news.t-online.com...
"Jez" <je**********@b tinternet.com> wrote in message
news:ad******** *************** ***@posting.goo gle.com...
Any ideas why I'm not able to use $_SERVER['HTTP_REFERER'] on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?


Just print it out to the browser:

print '<pre><xmp>';
print_r($_SERVE R);
print '</xmp></pre>';

and you see which keys are defined inside $_SERVER @ your hoster.


It could be related to your browser. Most firewall products will block the
sending of the HTTP_REFERER information to untrusted sites. If you can't
read HTTP_REFERER during testing, try turning your firewall off as it may
make a difference. Firewalls create a lot of problems for users and they
often blame the web developer for cookie problems, HTTP_REFERER issues and
spurious JavaScript errors when its the firewall's interference that has
caused the errors to occur. You can, and should, program around cookie and
REFERER issues but the JavaScript errors are moderately difficult to code
around unless you start using sneaky tactics. Such tactics for legitimate
purposes seem a bit bizarre but Symantec and ZoneAlarm create a significant
number of support issues through their default settings.

Paulus
Jul 17 '05 #10

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

Similar topics

1
2200
by: Krzysztof Piotrowski | last post by:
Hi all, I hale recently started using php - god fun :-D I decided to make visits statistics. My webpage http://www.kolumb.net/ has a statistic at http://www.kolumb.net/mysql/list_stats.php I hale a problem with $HTTP_REFERER variable ("Visited From" column). Sometimes it seems empty, for no reason. Could anyone help??
9
28654
by: deko | last post by:
I have a page that I don't want anyone to be able to link directly to. The page should only be accessed from gatepage.php. I tried this code, but keep getting errors - "header info already sent", or something like that... Am I missing something, or is there a better way to do this? <?php $ref = $_SERVER; //echo $ref; if ( $ref ==...
3
7961
by: Muffinman | last post by:
Hi, I have a script using the $_SERVER 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.
2
5625
by: ssk | last post by:
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");
17
3145
by: windandwaves | last post by:
Hi Folk I am reading the info below and I am thinking, just how trusted is it. I have a redirection in place using an .htaccess file. The file it redirects to is 404.php. Is there a way to find out what the file was that people entered originally? I was thinking about $_SERVER but that does not seem to do the trick (it is empty). ...
22
2419
by: walterbyrd | last post by:
I like to develop on my desktop, then when I get stuff working, I copy to my web-site. I set up a new version Xampp on my windows-2k desktop. And downloaded the stuff from the website to edit. On the website, everything worked, on my desktop, nothing works. I am guessing this has to do with PHP versions. I know PHP breaks everything...
8
2336
by: e_matthes | last post by:
Hello, I keep reading that $_SERVER can easily be faked. Is that true of all server variables, or just some of them? In particular, I'm wondering if server_port can be faked. I'm interested right now because I want to detect whether the current page request is using http or https. I realize there are other ways to ensure the correct...
3
4890
by: ojorus | last post by:
Hi! I'm using $_SERVER to see which site the visitors on my site is coming from. It works OK, but as we all now, not all sites give http_referer a value, i.e. miniclip.com. What I DON'T understand is how my web-statistics program (awstats) can tell me that a lot of the visitors on my site comes from miniclip.com. How can awstats know, and...
8
8966
by: mrsmithq | last post by:
I have a page that has this logic in it: //We can call it access.php if (!isset($_SESSION)){ header("Location:index.php"); exit(); } //Here is the index.php echo "<br>" . $_SERVER;
0
7401
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...
0
7808
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...
0
5972
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...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
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...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
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.