online.php
--------------
 
<? 
$timemax = "300"; //Max. tempo utenti on line sul sito
$ipadress = $REMOTE_ADDR; 
$timenow = explode (" ", microtime()); 
$timenow = $timenow[1]; 
include ("data.php"); 
$timedelete = $timemax; 
$deleted = $deleted + $timedelete; 
if ($deleted < $timenow){ 
$file = fopen("data.php","w+"); 
fputs($file, "<?PHP \$deleted = \"$timenow\"; ?>\n"); 
$number = count($visitor_b); 
for ($tel = 0; $tel < $number; $tel++){ 
$visitor_a = $visitor_b[$tel]; 
$visitor_a[0] = $visitor_a[0] + $timemax; 
if ($visitor_a[0] > $timenow) 
fputs($file, "<?PHP \$visitor_b[] = array('$visitor_a[0]','$visitor_a[1]'); ?>\n"); 
} 
fclose($file); 
} 
$visitor_b = ""; 
include ("data.php"); 
$number = count($visitor_b); 
for ($tel = 0; $tel < $number; $tel++){ 
$visitor_a = $visitor_b[$tel]; 
if ($visitor_a[1] == $ipadress) 
$save = "nee"; 
} 
if (!$save){ 
$file = fopen("data.php","a"); 
fputs($file, "<?PHP \$visitor_b[] = array('$timenow','$ipadress'); ?>\n"); 
fclose($file); 
} 
$visitor_b = ""; 
include ("data.php"); 
$number = count($visitor_b); 
for ($tel = 0; $tel < $number; $tel++){ 
$visitor_a = $visitor_b[$tel]; 
$visitor_a[0] = $visitor_a[0] + $timemax; 
if ($visitor_a[0] > $timenow) 
$online = $online + 1; 
} 
if (!$online) 
$online = 1; 
if ($online == 1) 
print ("$online utente online"); 
else 
print ("$online utenti online"); 
?>  
 
crea poi un file data.php e fai il chmod 777 su questo