Forum Moderators: coopster

Message Too Old, No Replies

How Do I Add "Referrer" To This Script?

         

Christyl Stevens

6:21 pm on May 21, 2004 (gmt 0)

10+ Year Member



I would like to know what I would need to add to the following code in order to be able to learn where the visitor to my page just came from?

The referring page is what I am wanting to include into the email that is sent to me each time my page gets a visitor.

Here is the code that I have now.

<?php
if(eregi("mozilla",$HTTP_USER_AGENT))
{
mail("name@domain.com", "Mozilla Just Visited", "Mozilla just visited < [domain.com...] >");
}
?>

TIA

bunltd

6:40 pm on May 21, 2004 (gmt 0)

10+ Year Member



something like this: (will give you referer and query string)
// add this 
$referer = $_GET['referrer'];
$camefrom = ($_SERVER[ "HTTP_REFERER" ]);
$qs = ($HTTP_SERVER_VARS["QUERY_STRING"]);
// then add these to your e-mail statement: $camefrom $qs

LisaB