PHP Front
The PHP website created by its users!
Home » PHP » IP/Host


IP/Host


AuthorCarpenter
Description This script logs IP, host name, date and page. Create an empty file "log.html". Create "log.php" and paste code1. Paste code2 in any .html file just before the tag and rename to .php
RatingThis script has been rated 4/5 (5 votes)

PHP Code


// 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($fp3);// Unlock log
fclose($fp);// Close file
?>

//code2
<?PHP include_once('log.php');
?>



Rate it: Print Print

Comments


No comments posted yet.

Name
Website
Your comment