Changeset 5233
- Timestamp:
- 12/09/11 09:24:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.totalsessions.inc.php
r414 r5233 46 46 47 47 $total = $this->get_total_sessions(); 48 48 49 49 $this->template->set_var('back_url', $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php')); 50 50 $this->template->set_var('total', $total); … … 56 56 { 57 57 $values = array(); 58 $dir = @opendir($path = ini_get('session.save_path')); 59 $total = 0; 60 61 if (!$dir) // eg. openbasedir restrictions 62 { 63 return $values; 64 } 65 while ($file = readdir($dir)) 66 { 67 if (substr($file,0,5) != 'sess_') 68 { 69 continue; 70 } 71 if (!is_readable($path. '/' . $file)) 72 { 73 continue; // happens if webserver runs multiple user-ids 74 } 75 76 $fd = fopen ($path . '/' . $file,'r'); 77 $session = @fread ($fd, filesize ($path . '/' . $file)); 78 fclose ($fd); 58 59 //files memcache 60 switch(ini_get('session.save_handler')){ 61 case "memcache" : $mem = new Memcache(); 62 $arrayretorno = $mem->getStats(); 63 break; 64 case "files": 65 default : 79 66 80 if (substr($session,0,14) != 'phpgw_session|') 81 { 82 continue; 83 } 84 85 $total++; 86 } 87 closedir($dir); 88 return $total; 89 } 90 } 67 $dir = opendir($path = ini_get('session.save_path')); 68 $total = 0; 69 70 while ($file = readdir($dir)) 71 { 72 $session = file_get_contents( $path . '/' . $file, false, null, 0, 50 ); 73 74 if( substr($file,0,5) != 'sess_' || 75 !$session || // happens if webserver runs multiple user-ids 76 strstr( $session, 'phpgw_sess' ) === FALSE ) 77 { 78 continue; 79 } 80 81 $total++; 82 } 83 84 closedir($dir); 85 86 return $total; 87 88 } 89 } 90 }
Note: See TracChangeset
for help on using the changeset viewer.