IP LOGGER

 

An IP Logger is a very useful object to have on your website. With an IP Logger you can log the IP's of everyone who visits your site, making banning IP's easier.

Lets begin by creating a new .txt file and calling it ips.txt (you may call it anything you wish, but remember to change ips.txt to the name of your file later on). Upload this file to your root directory and CHMOD it to 777. This is the file to which all the IP's will be written.

Now for the fun part, the PHP scripting. Lets make a new file, calling it anything you want (as long as you have a .php extensions for it) and insert the following code into it:
<?
$log_file = "ips.txt";
$ip = getenv(\'REMOTE_ADDR\');
$fp = fopen("$log_file", "a");
fputs($fp, "$iprn");
flock($fp, 3);
fclose($fp);
PRINT("your IP has been logged.....$ip");
?>

Now if we wish to customize the message that is displayed to the user we can simply add some HTML formatting to the text, maybe an image or anything you please as long as you remember to add a backslash (/) before any HTML-Tag related ".

Hosted by www.Geocities.ws

1