<?php
// IP logger, place file at yourdomain.com/log.php
//This picture variable defines which image to show
$picture = "http://img.infotropic.com/w/w060529_2.jpg";
//Visitor's IP address is stored in the variable '$ip'
$ip = $_SERVER['REMOTE_ADDR'];
//this line tells the logger the name you want to use for the log file.
// if log.txt doesn't already exist, it will be created automatically
$logs = "log.txt";
//here, we open the log.txt for writing to. The 'a' means append to the EOF
$fh = fopen($logs, 'a') or die(" ");
//here we put the ip address into a variable called 'string data'
// the backslash-n starts a new line in the text file, to make it easier to read
$stringData = "$ip \n";
//here we write to the text file what is in the stringdata variable
fwrite($fh, $stringData);
//now we close the file
fclose($fh);
//and finally we echo some html back to the user's browser so they see an image
echo "<img src='$picture'>";
?>
Note:
If you want to learn web technologies, www.w3schools.com is a pretty good website.
0 comments:
Post a Comment
Write your comment here