tags:

views:

40

answers:

2

$referal = mysql_real_escape_string($_SERVER['HTTP_REFERER']);

I would like to store this the first time the visitor comes to my site through a referer. so when this page is accessed again, the variable will not change.

+2  A: 

Put it in the session:

$_SESSION['referrer'] = $_SERVER['HTTP_REFERER'];
Ignacio Vazquez-Abrams
+2  A: 

You can store it in a database combined with the IP-address of the visitor. Next time the visitor drops by, you check if the IP-address is known and if it does, just not add it again.

You could extend this by adding the time of the last visit and after a day or something you can add a new record for the visitor. This way you have a very simple visitor counter.

Veger