A simple little PHP script to log IPs along with a datestamp of when they were logged. Yep, that simple.
Code:
<?php
$file_name = ('./ip_log.txt');
$time = date("d/m/Y h:i A" ,time());
$ip = $_SERVER['REMOTE_ADDR'];
$fp = fopen($file_name, "a");
fwrite($fp, "IP: ".$ip." - Time: ".$time."\n");
fclose($fp);
?>
If you want to be a LITTLE fancier, you can make it deny access to the file when they try and access it.
Code:
<?php
$file_name = ('./ip_log.php');
$time = date("d/m/Y h:i A" ,time());
$ip = $_SERVER['REMOTE_ADDR'];
if(!file_exists($file_name)){
$fp = fopen($file_name, "w");
fwrite($fp, "<?php die('Oi! This file is private! No peeking!');?>");
fclose($fp);}
$fp = fopen($file_name, "a");
fwrite($fp, "IP: ".$ip." - Time: ".$time."\n");
fclose($fp);
?>
Enjoy!