Access_Denied's Forums

Site Resources => Snippets => Topic started by: Access_Denied on August 16, 2007, 10:37:12 AM



Title: Snippet: Log IP Address
Post by: Access_Denied on August 16, 2007, 10:37:12 AM
Here's a quick snippet that logs the IP address of the visitor, as well as the time and date.

<?php
$file = fopen("log.txt",a);
$ipaddress = $_SERVER['REMOTE_ADDR']." - ".date("r");
fwrite($file,$ipaddress);
fclose($file);
?>

Here's how log.txt should look:

IPAddress - DayOfWeek, DayOfMonth Month Year Hour:Minute:Second Timezone


Hosted by www.Geocities.ws

1