True ); function totalsessions() { $this->functions = createobject('expressoAdmin1_2.functions'); $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; $tmp = $this->functions->read_acl($account_lid); $manager_context = $tmp[0]['context']; // Verifica se o administrador tem acesso. if (!$this->functions->check_acl($account_lid,'view_global_sessions')) { $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); } $this->template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); } function show_total_sessions() { $GLOBALS['phpgw_info']['flags']['app_header'] = 'ExpressoAdmin - '.lang('Total Sessions'); $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); $this->template->set_file('template','totalsessions.tpl'); $this->template->set_block('template','list','list'); $this->template->set_var($this->functions->make_dinamic_lang($this->template, 'list')); $total = $this->get_total_sessions(); $this->template->set_var('back_url', $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php')); $this->template->set_var('total', $total); $this->template->pfp('out','list'); } function get_total_sessions() { $values = array(); $dir = @opendir($path = ini_get('session.save_path')); $total = 0; if (!$dir) // eg. openbasedir restrictions { return $values; } while ($file = readdir($dir)) { if (substr($file,0,5) != 'sess_') { continue; } if (!is_readable($path. '/' . $file)) { continue; // happens if webserver runs multiple user-ids } $fd = fopen ($path . '/' . $file,'r'); $session = @fread ($fd, 50); fclose ($fd); if (strstr($session,'phpgw_session|') === FALSE) { continue; } $total++; } closedir($dir); return $total; } }