What you need: PHP Enabled website.
And ftp client.
Save this file as data.php upload it and chomod it in the ftp to 777.
Insert this where you want the online users displayed.
Code:
<?php
$timemax = "300"; //Max. time that users are online on your site (in sec.)
$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 ("Users Online: $online");
else
print ("Users Online: $online");
?>