im trying to get my script to read ip's from a flat file which i have done no problem, the problem i having is getting it to not count blank lines, i've looked over google for over an hour and i can't find a way to do it?
My code:
<?
$Countfile = "Count.cnt";
$visip = $_SERVER['REMOTE_ADDR'];
$fh = fopen($Countfile, "a"); // open file
$string = "\n$visip";
// fwrite($fh, $string);
$lines = count(file($Countfile));
$chars = preg_split('//', $lines, -1, PREG_SPLIT_NO_EMPTY);
$i=0;
while($i <= $lines)
{
$number = array("1","2","3","4","5","6","7","8","9","0");
$numimage = array("<img src=\"images/gc/1.jpg\">","<img src=\"images/gc/2.jpg\">","<img src=\"images/gc/3.jpg\">","<img src=\"images/gc/4.jpg\">","<img src=\"images/gc/5.jpg\">","<img src=\"images/gc/6.jpg\">","<img src=\"images/gc/7.jpg\">","<img src=\"images/gc/8.jpg\">","<img src=\"images/gc/9.jpg\">","<img src=\"images/gc/0.jpg\">");
echo str_replace($number, $numimage, $chars[$i]);
$i++;
}
?>
So would any be able to explain how i go about missing blank lines out of the count?
Thanks.