PDA

View Full Version : logging ips



dipman44
07-08-2007, 04:03 PM
how would a write a script that will log ip addresses on to a txt or something if they visit a certain page?

Moonbat
07-08-2007, 07:08 PM
A simple Google of "IP Logger in PHP" gave me this PHP code.


<?php
$logfile= '/full_path_to/log.html';
$IP = $_SERVER['REMOTE_ADDR'];
$logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>';
$fp = fopen($logfile, "a");
fwrite($fp, $logdetails);
fwrite($fp, "<br>");
fclose($fp);
?>

dipman44
07-09-2007, 02:30 PM
aight thanks!