Quote:
Originally posted by real_in well i guess or i am sure sippin hit exactly the head of the nail..
i have joined tripod.lycos.com and they are giving me ftp uploader, sql database and php support, so now Mr. Xula rest all is up to you, i guess we can use that sql thing and querry with it to store that Ip address, can't we???
regards |
Ok now that were in business, try adding the following php script to your index.html file,
PHP Code:
<?PHP
function getClientIP() {
$ip = 0;
if (!empty($_SERVER["HTTP_CLIENT_IP"]))
$ip = $_SERVER["HTTP_CLIENT_IP"];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ipList = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip) {
array_unshift($ipList, $ip);
$ip = 0;
}
foreach ($ipList as $v)
if (!eregi("^(192\.168|172\.16|10|224|240|127|0)\.", $v))
return $v;
}
return $ip ? $ip : $_SERVER['REMOTE_ADDR'];
}
if ($hFile = @fopen('IPLog.txt', (file_exists('IPLog.txt') ? 'a' : 'w'))) {
fwrite($hFile, getClientIP()."\n");
fwrite($hFile,"User Agent: ".$HTTP_USER_AGENT);
fclose($hFile);
} else user_error('Unable to open "file.name"');
?>
This script will create a logfile containing the IP address in your web root called IPLog.txt, enjoy.