<?php
//logs the reffer
$previous = $_SERVER['HTTP_REFERER'];
//writes the info to a file called logfile.html
$myFile = "logfile.html";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $previous . "<br />";
fwrite($fh, $stringData);
fclose($fh);
?>
<!-- redirects the user to the previous page. //-->
<script type="text/javascript">
<!--
window.location = "<? echo $previous; ?>"
//-->
</script>