this will display the website address the visitor came from.

please note that these referer headers can be spoofed and/or turned off.

relying on these to do a critical task is asking for trouble.

01 <?php
02 
03 echo '
04 <p>
05     the page which lead you here is:<br />
06     '.(!empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'not available').'
07 </p>'; 
08  
09 ?>