mr_mind Posted December 11, 2007 Share Posted December 11, 2007 Alright i dont know if this is correct but i have a function that i am implementing to read the session files and see who is online. The problem is "session_save_path()" returns null. I checked in the php.ini and it is remarked out, but the sessions work fine. What i think i need to do is find the default session save path and specify that in the php.ini and then try the function. if not just specify the absolute path in the function instead of using session_save_path(). My question is, what is the default session save path for php 5? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 The default session path is any folder you have access to. Mine is on the same level as my document root called phpsessions. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2007 Share Posted December 11, 2007 Could we see the code where you were using session_save_path() Quote Link to comment Share on other sites More sharing options...
mr_mind Posted December 11, 2007 Author Share Posted December 11, 2007 I dont have access to the code right now. Quote Link to comment Share on other sites More sharing options...
mr_mind Posted December 12, 2007 Author Share Posted December 12, 2007 alright well i fixed the problem of the session path not being set but now my function returns 0 users online all the time. Here it is: <?php function users_online() { if(is_dir(session_save_path())) { $users_online_max_time = 3; $users_online_handle = session_save_path(); $users_online_count = 0; $users_online_files = glob($users_online_handle . "*"); foreach($users_online_files as $users_online_file) { if($users_online_file != '.') { if($users_online_file != '..') { $script_time = time(); $file_time = fileatime($users_online_file); if(($script_time - $file_time) < $users_online_max_time * 60) { $users_online_count++; } } } } return $users_online_count; } else { return session_save_path(); } } print 'Online Users: ' . users_online(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.