473,554 Members | 2,291 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 30886
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
2202
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
28661
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
7963
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
5628
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
3146
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
2337
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
8968
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
7812
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. ...
0
8051
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...
1
7574
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7894
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...
0
3579
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
3561
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2026
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
1145
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.