Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
yeko is on a distinguished road
 
Posts: 6
Join Date: Jun 2008
Default Session save path ? - 11-12-2008, 07:12 PM

hi

I am creating a script that counts the users that are logged in. I have found a tutorial of how to make it. It counts the sessions created by reading the session files that are in the session save path. I found out in phpinfo that the session save path = /tmp.
The script isn't working. When i remove the time safety it gives me a result but that is absolutly not correct. Can someone help me with this ?
Your help will be greatly apriciated.

My script :
PHP Code:
<?php
session_start
();
session_save_path("/tmp");

define("MAX_IDLE_TIME"3);

function 
getOnlineUsers(){

if ( 
$directory_handle opendirsession_save_path() ) ) {
$count 0;
while ( 
false !== ( $file readdir$directory_handle ) ) ) {
if(
$file != '.' && $file != '..'){

if(
time()- fileatime(session_save_path() . '\\' $file) < MAX_IDLE_TIME 60) {
$count++;
}
}
}
closedir($directory_handle);

return 
$count;

} else {
return 
false;
}

}

echo 
'Number of online users: ' getOnlineUsers() . '<br />';
?>
Reply With Quote
(#2 (permalink))
Old
Junior Member
yeko is on a distinguished road
 
Posts: 6
Join Date: Jun 2008
Default nobody knows ? - 12-08-2008, 10:00 PM

nobody knows ?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0
vBulletin Skin developed by: vBStyles.com