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();

?>

Comments

Popular posts from this blog

dynamic create multiple ckeditor onclick event using jquery

get lat and long from city name using jquery

membership registration and login system in php