online visitor counter
<?php
session_start();
function getUsersOnline() {
$count = 0;
$handle = opendir(session_save_path());
if ($handle == false) return -1;
while (($file = readdir($handle)) != false) {
if (ereg("^sess", $file)) $count++;
}
closedir($handle);
return $count;
}
?>
then just call it using this
<?php
echo $usercount = getUsersOnline();
?>
session_start();
function getUsersOnline() {
$count = 0;
$handle = opendir(session_save_path());
if ($handle == false) return -1;
while (($file = readdir($handle)) != false) {
if (ereg("^sess", $file)) $count++;
}
closedir($handle);
return $count;
}
?>
then just call it using this
<?php
echo $usercount = getUsersOnline();
?>
Comments
Post a Comment