Jump to content

Recommended Posts

Hi, im trying to record a referring URL into a database to act as part of a web statistics facility on a web project that i'm doing however strangely the '$_SERVER['HTTP_REFERER']' function will only record referring URLs from my website and not from others. For example if i have been to www.google.com and then navigate strait to the web page on my website which records the referring address, nothing gets recorded and the database record is left blank. All other data is successfully written to the database however and it is not a problem with variables etc as like i have already said, it will record web URLs from my website.

 

Can anyone shed any light on the matter for me???

 

Cheers!

Link to comment
https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/
Share on other sites

Sure, heres what im doing in a file called stats_logg which is called at the top of my home page only:

 


$referal = $_SERVER['HTTP_REFERER']; 

$query = "INSERT INTO stats(address, date)VALUES ('$referal', now())";
mysql_query($query)or die("Error, query failed");

The referrer only works if you click a link. Unless you have about $1,000,000,000,000, you don't have a link on the google homepage. Did you search for yourself and click a link or did you go to google and then type your own address into the address bar or click a bookmark?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.