Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Web Programming
Reload this Page Is the server blocking HTTP_REFERER information?
Reply
 
Thread Tools Display Modes
(#1 (permalink))
Old
Junior Member
arbpen is on a distinguished road
 
Posts: 22
Join Date: May 2008
Default Is the server blocking HTTP_REFERER information? - 08-07-2008, 03:46 AM

On my localhost, I can see HTTP_REFERER information, but I cannot see it on the server. The variable does not show when looping through the $_SERVER collection, although all the other server variables, such as HTTP_USER_AGENT, HTTP_ACCEPT, etc., are showing as expected.

You can see this at [http://mywonderyears.org]. If you click on Userlog, you will see the server variables printed. If you go to the Home page, then back to Userlog, the referer information SHOULD BE index.php, however, the referer information is not there.

Is it being blocked, and if so, why, and can it be unblocked?
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
lenwhistler's Avatar
Senior Member
lenwhistler is on a distinguished road
 
Posts: 161
Join Date: Jul 2008
Location: Vancouver, Canada
Default 08-07-2008, 04:21 AM

I posted a similar question last week. Instead of:

$HTTP_SERVER_VARS['HTTP_REFERER'];

Use:

$_SERVER['HTTP_REFERER'];
Reply With Quote
(#3 (permalink))
Old
Junior Member
arbpen is on a distinguished road
 
Posts: 22
Join Date: May 2008
Default 08-07-2008, 07:30 AM

Quote:
Originally Posted by lenwhistler View Post
I posted a similar question last week. Instead of:

$HTTP_SERVER_VARS['HTTP_REFERER'];

Use:

$_SERVER['HTTP_REFERER'];
That is what I am using. Here's my code:

$ip = $_SERVER['REMOTE_ADDR'];
$method = $_SERVER['REQUEST_METHOD'];
$uri_stem = $_SERVER['SCRIPT_NAME'];
$uri_query = $_SERVER['QUERY_STRING'];
$status = "200";
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$cookie = $_SERVER['HTTP_COOKIE'];
if(isset($_SERVER['HTTP_REFERER']))
{$referer = $_SERVER['HTTP_REFERER'];}
else
{$referer = "";}
$host = $_SERVER['HTTP_HOST'];
$accept = $_SERVER['HTTP_ACCEPT'];


$insert = "INSERT INTO stats".
"(ip, method, uri_stem, uri_query, status, user_agent, cookie, referer, host, accept, added)".
" VALUES ('".$ip."', ".
"'".$method."', ".
"'".$uri_stem."', ".
"'".$uri_query."', ".
"200, ".
"'".$user_agent."', ".
"'".$cookie."', ".
"'".$referer."', ".
"'".$host."', ".
"'".$accept."', ".
"NOW())";

echo $insert;
echo "<br>".$referer;

On my development server (localhost), this is what is echoed out to the client:
insert: INSERT INTO stats(ip, method, uri_stem, uri_query, status, user_agent, cookie, referer, host, accept, added) VALUES ('127.0.0.1', 'GET', '/wonderyears/servervar.php', '', 200, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)', '', 'http://localhost/wonderyears/calendar.php', 'localhost', '*/*', NOW())
referrer:http://localhost/wonderyears/calendar.php

On the production server, this is what is echoed out back to the client:
insert: INSERT INTO stats(ip, method, uri_stem, uri_query, status, user_agent, cookie, referer, host, accept, added) VALUES ('66.214.143.224', 'GET', '/servervar.php', '', 200, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)', '', '', 'mywonderyears.org', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*', NOW())
referrer:

Notice that referrer has a value on the development server, and is blank on the production server.
Reply With Quote
(#4 (permalink))
Old
lenwhistler's Avatar
Senior Member
lenwhistler is on a distinguished road
 
Posts: 161
Join Date: Jul 2008
Location: Vancouver, Canada
Default 08-07-2008, 03:41 PM

Then I would try:

$HTTP_SERVER_VARS['HTTP_REFERER'];
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com