I've Install this script to my site but It won't function that well
Here's the code, which logs client side IP in a flat file or *.txt
<?php
$filename = "uniqueLogs.txt";
$file = file($filename);
$file = array_unique($file);
$hits = count($file);
echo $hits;
$fd = fopen ($filename , "r");
$fstring = fread ($fd , filesize ($filename));
fclose($fd);
$fd = fopen ($filename , "w");
$fcounted = $fstring."\n".getenv("REMOTE_ADDR");
$fout= fwrite ($fd , $fcounted );
fclose($fd);
?>
but if you will look to that file/ *.txt it logs the IP horizontally
n203.87.184.2n203.87.184.2n222.127.223.71n203.87.184.2n203.87.184.2n203.87.184.2n203.87.184.2
.....
What I notice is the script is unreliable because it won't show the right numeral's for its the number of user visited the site and the file continues to write on the flat file w/c was been already log.
My question was their a function that logs and write without replicates..