|
|
IP/Host
|
tag and rename to .php
(2 votes)
// code1
<?
$log_file = "log.html";// Targets the log file
$ip = $REMOTE_ADDR;// Gets the IP
$page = $_SERVER['REQUEST_URI'];// Gets page location
$host = gethostbyaddr($REMOTE_ADDR);// Gets the host name
$date_time = date('d-m-Y/H:i:s');// Gets the date
$fp = fopen("$log_file", "a");// The a means write a new line, instead of overwrite
fputs ($fp," ($date_time) $ip ($host) $page");// What to write
fwrite($fp, "<br>");// html break to view each ip on different line
flock($fp, 3);// Unlock log
fclose($fp);// Close file
?>
//code2
<?PHP include_once('log.php');
?>
No comments posted yet.