logging referer information
Moderator: General Moderators
-
phpnewbie1985
- Forum Commoner
- Posts: 33
- Joined: Thu Jan 08, 2004 6:15 am
logging referer information
Im confused, im using META refresh to re-direct a site of mine at the moment and i would like to log the users that go to the redirection page (page A) in either a text file or a webpage. the problem is when i have tried to do this it never logs the place where the referer came from (page A) anyone have any ideas?
Many thanks
Chris
Many thanks
Chris
-
phpnewbie1985
- Forum Commoner
- Posts: 33
- Joined: Thu Jan 08, 2004 6:15 am
code
Page A (refering site)
Page B (site it takes you too and meant to store info but only stores it if you click the link)
Hope this helps?
Many thanks
Chris
Code: Select all
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="en-gb">
<META HTTP-EQUIV="refresh" content="1;URL=pageB.htm">
<TITLE>Loading...</TITLE>
</HEAD>
<BODY>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><font face="Arial">Loading...</font></p>
<p align="center"><font face="Arial">If the page does not load please
<a href="pageB.htm">click here</a>.</font></p>
</BODY>
</HTML>Code: Select all
<?
$refer = $HTTP_REFERER;
$newrefer = "$refer" . "\n";
$file_pointer = fopen("refer.txt", "a+");
fwrite($file_pointer, $newrefer);
fclose($file_pointer);
?>Many thanks
Chris
try changing
to..
What version of PHP you running?
Mark
Code: Select all
$refer = $HTTP_REFERER;Code: Select all
$refer = $_SERVER["HTTP_REFERER"];Mark
-
phpnewbie1985
- Forum Commoner
- Posts: 33
- Joined: Thu Jan 08, 2004 6:15 am
-
phpnewbie1985
- Forum Commoner
- Posts: 33
- Joined: Thu Jan 08, 2004 6:15 am
ok sorry it was a php it goes to, but actually its just going to the domain.. http://www.domain.com/ but the index page is a php page. me being a muppet
Chris
Chris
-
phpnewbie1985
- Forum Commoner
- Posts: 33
- Joined: Thu Jan 08, 2004 6:15 am
okay, looked at my code, it wasn't anything to do with this problem.
But..
I was just reading that The headers that are sent are dependent on browser and OS.
I have just tried your scirpt on a MAC running OS9 and Netscape 4.7 and it worked perfectly.
The only think i can think you can do is hard code the referer in the mete refresh tag like this
If you could make pageA a PHP page, you cold generate the URL in the meta refresh
Mark
But..
I was just reading that The headers that are sent are dependent on browser and OS.
I have just tried your scirpt on a MAC running OS9 and Netscape 4.7 and it worked perfectly.
The only think i can think you can do is hard code the referer in the mete refresh tag like this
Code: Select all
<META HTTP-EQUIV="refresh" content="1;URL=pageB.htm?referer=pageA.htm">Mark
-
phpnewbie1985
- Forum Commoner
- Posts: 33
- Joined: Thu Jan 08, 2004 6:15 am
Thanks that worked! and in page B i had to change where it said
to
many thanks for your help
chris
Code: Select all
$refer = $_SERVERї"HTTP_REFERER"];Code: Select all
$refer = $referer;chris