robcrozier Posted March 5, 2007 Share Posted March 5, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/ Share on other sites More sharing options...
redarrow Posted March 5, 2007 Share Posted March 5, 2007 Can we see the code please cheers. Quote Link to comment https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/#findComment-199859 Share on other sites More sharing options...
robcrozier Posted March 5, 2007 Author Share Posted March 5, 2007 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"); Quote Link to comment https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/#findComment-199862 Share on other sites More sharing options...
superuser2 Posted March 5, 2007 Share Posted March 5, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/#findComment-199867 Share on other sites More sharing options...
robcrozier Posted March 5, 2007 Author Share Posted March 5, 2007 Yeah yeah, I've just realised that now, silly me! I don't suppose there is any way that the last address you visited can be logged is there??? cheers! Quote Link to comment https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/#findComment-199870 Share on other sites More sharing options...
superuser2 Posted March 5, 2007 Share Posted March 5, 2007 Nope. You cannot track that. a) There's not really the technology to do that. b) Privacy issues Even the referrer is sent by the user, they can tamper with/remove that if they want to. Quote Link to comment https://forums.phpfreaks.com/topic/41256-_serverhttp_referer-not-working/#findComment-199873 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.