Hi Graphix!
Thanks for thoughts in the code, much appreciated. I tried the code out..I did change
<?php
echo "The content of the file, split by a \n, as an array:";
$linesArray = split("\n",$content);
~G
To
echo 'The content of the file, split by a \\r\\n, as an array:';
$linesArray = split("\r\n",$content);
so it would display nicely and work on WAMP Windows 7.
Unfortunately it didn't work..I just keep getting an ever growing IP list. There is the error too on the page:
StartLine:-4
Notice: Undefined offset: -4 in C:\wamp\www\IP related\testip.php on line 55
Notice: Undefined offset: -3 in C:\wamp\www\IP related\testip.php on line 55
Notice: Undefined offset: -2 in C:\wamp\wwwIP related\testip.php on line 55
Notice: Undefined offset: -1 in C:\wamp\www\IP related\testip.php on line 55
In case it makes a difference, here's the code preceeding your's that picks up the IP and appends it:
//Grab the IP of the visitor
function get_ip_list() {
$tmp = array();
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && strpos($_SERVER['HTTP_X_FORWARDED_FOR'],',')) {
$tmp += explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$tmp[] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$tmp[] = $_SERVER['REMOTE_ADDR'];
return $tmp;
}
$iptmp = get_ip_list();
$ip = implode(",",$iptmp);
echo '<a href=' . 'http://ip-whois-lookup.com/lookup.php?ip=' . $ip . '>' . $ip . '</a>';
//Append to IPs.html the date/time & IP vistor info
$logfile= 'IPs.html';
$logdetails= date("j-M-Y, g:i a") . ' from ' . '<a href=' . 'http://ip-whois-lookup.com/lookup.php?ip=' . $ip . '>' . $ip . '</a>';
$fp = fopen($logfile, "a");
fwrite($fp, $logdetails);
fwrite($fp, "");
fclose($fp);
Looking forward to the insights