Sure ,you need a php script for the job:
- Code: Select all
<?php
if (! filesize('ip.html')==0)
{
$ipz=fread('ip.html',filesize('ip.html'));
}
if (! isset($ipz))
{
$ipz='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><body></body></html>';
}
$ipz=substr($ipz,0,strlen($ipz)-14).$_SERVER['REMOTE_ADDR'].'<br></body></html>';
$wip=fopen('ip.html','w');
fwrite($wip,$ipz);
fclose($wip);
?>
This will do it.
Notes:
The page on wich you put this script must have the extension *.php or the webserver must be configured to allow php code in *.html files ,you can put the script anywhere on your page it doesn`t make any difference to it.
The file "ip.html" or the whole directory that contains it must be writable by the webserver ,this can be accomplished two ways:
-1)you create an
empty(it must not contain a single character or the script won`t work properly) file called "ip.html" ,and make it writable by the webserver ,the most simple way to do that is type this command
- Code: Select all
chmod 777 ip.html
in your favorite ftp client when you`re in the ftp directory of "ip.html"
-2)the same way as mentioned above you can type a command
- Code: Select all
chmod 777 .
,didn`t test this ,but this should make the whole directory writable by the webserver and the script would create the file ,if you do this ,you don`t need to create the empty "ip.html" just type this command.