?
Solved

$HTTP_REFERER on win XP

Posted on 2005-03-02
11
Medium Priority
?
304 Views
Last Modified: 2008-03-06
Hi there,

I want to use the PHP variable $HTTP_REFERER fro checking if the user is come to a page from
my domain (just a security check). But looks like $HTTP_REFERER doesnot work on windows XP.

Any solution for this please?
0
Comment
Question by:storney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 13437351
Try

$_SERVER["HTTP_REFERER"];
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13437354
Newer versions of PHP doesn't support the direct $HTTP_REFERER.
0
 

Author Comment

by:storney
ID: 13437367
Also tried using $_SERVER["HTTP_REFERER"]; doesn't  work
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
LVL 32

Expert Comment

by:Batalf
ID: 13437391
ok, then try

$HTTP_SERVER_VARS['HTTP_REFERER']

0
 
LVL 32

Expert Comment

by:Batalf
ID: 13437401
or

getenv('HTTP_REFERER')
0
 

Author Comment

by:storney
ID: 13437706
sorry it doessn't work with any of the above
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13437736
Strange.

And I assume you have tried creating two pages where page 1 got a link to page 2 and in page 2 you output HTTP_REFERER? It would be empty otherwise.
0
 

Author Comment

by:storney
ID: 13437762
oh yes!!!!
It shows the referer url on Win 98 but no output on XP
0
 
LVL 27

Accepted Solution

by:
Diablo84 earned 1000 total points
ID: 13438141
It is important to remember that the HTTP_REFERER is set client side and is not a reliable factor at the best of times. It may be that you have a program running that is blocking the referer from being sent on the XP machine... i vaguely recall one of our experts at some point indicating that one of the norton products blocks it from being sent. So, it may be worth while checking the configuration of any software you have installed that is related to the security of your machine, perhaps even any browser extensions you may have.

Unless you are using the referer in relation to observing incoming traffic from an external site i usually recommend a more reliable method using sessions. It works a little like this:

session_start();
if (isset($_SESSION['cur'])) $_SESSION['prev'] = $_SESSION['cur'];
$_SESSION['cur'] = $_SERVER['PHP_SELF'];

The above would go on every page (in an include file for convenience). If the current page has been assigned to the session variable 'cur' when the page loads then this value will be assigned to the session variable, 'prev'. After that the variable 'cur' will be updated with the current page. You can add more information into the current page variable such as the host, query string etc if you want the full page info. This means that the referering page will be available in $_SESSION['prev'] BUT will only work internally (ie. tracking pages around your site, not from or to external sites).

Diablo84
0
 
LVL 11

Expert Comment

by:neester
ID: 15640061
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept Diablo84's Solution

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

- Neester -
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question