Online counter
Posted: Thu Sep 22, 2005 11:16 am
can anyone see what is wrong with this code. I only get 1 visitor when I know that there are several visitors on my webbsite.
Code: Select all
<?php
$fil = "logg.txt";
$ip = $_SERVER['REMOTE_ADDR'];
$tid = date('d/m H:i');
$online = file($fil);
$count = 1;
for($n=0; $n < count($online); $n++){
$file_ip = explode(" | ", $online[$n]);
if($file_ip[0] == $tid && $file_ip[1] != $ip."\n"){
$count++;
}
}
echo " Online now: ".$count;
?>