473,320 Members | 2,110 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,320 software developers and data experts.

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 30863
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**********@btinternet.com (Jez) wrote in message news:<ad**************************@posting.google. 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=http://$_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**********@btinternet.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*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #4

"Jez" <je**********@btinternet.com> wrote in message
news:ad**************************@posting.google.c om...
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**********@btinternet.com> wrote in message
news:ad**************************@posting.google.c om...
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($_SERVER);
print '</xmp></pre>';

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

regards

timo

Jul 17 '05 #6
Jez wrote:
je**********@btinternet.com (Jez) wrote in message news:<ad**************************@posting.google. 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=http://$_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**********@btinternet.com (Jez) wrote in message news:<ad**************************@posting.google. com>...
je**********@btinternet.com (Jez) wrote in message news:<ad**************************@posting.google. 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=http://$_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*******@fli7e.de> wrote in message
news:bl*************@news.t-online.com...
"Jez" <je**********@btinternet.com> wrote in message
news:ad**************************@posting.google.c om...
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($_SERVER);
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
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 ...
9
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",...
3
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,...
2
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. ...
17
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...
22
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....
8
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...
3
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...
8
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
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.