// you must set your own accessible session path atop every page. session_save_path("/home/some/other/location/"); # SECURITY VIOLATION!!! session_start(); function session_count() { $filter = "sess_"; $files = scandir(session_save_path()); $count = 0; foreach ($files as $file) { if(strpos($file,$filter)===0) { $count += 1; } } return $count; } echo session_count(); ?>