Log use IP address
<?php
$address = $_SERVER['REMOTE_ADDR'];
$referer = $_SERVER['HTTP_REFERER'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$file = fopen("log.html", "a");
$time = date("H:i dS F");
fwrite( $file, "<b>Time:</b> $time<br>" );
if( $address != null)
{
fwrite( $file, "<b>IP Address:</b> $address <br>");
}
if( $referer != null)
{
fwrite( $file, "<b>Referer:</b> $referer<br>");
}
fwrite( $file, "<b>Browser:</b> $browser<br/><hr>");
fclose($file);
?>
Related examples in the same category