',"\n"; if (stristr($ezin_cfg['admin_buttons_pos'], 'U')) { ezin_admin_sessions_limit_field($limit, 'up'); echo '
',"\n"; } /* * Database query for getting sessions */ $query = 'SELECT' .' id, session_id, username,' . ($restricted ? '' : ' password,') .' login, logout, status, ip, user_agent' .' FROM ' . $ezin_sys['db']['tables']['sessions'] .' ORDER BY logout DESC, login DESC'; if (intval($limit) > 0) $query .= ' LIMIT ' . intval($limit); //echo "$query
"; $result = mysqli_query($ezin_db_handle, $query); if ($result == false) { ezin_db_error('ezin_admin_sessions_main()'); return false; } echo '',"\n"; if (mysqli_num_rows($result) == 0) { echo ''; } $count = 0; $tr_data = array('', ''); while (($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) != null) { $user_agent = $row['user_agent']; unset($row['user_agent']); if ($count == 0) { echo '',"\n"; foreach (array_keys($row) as $key) { $key = str_replace('_', ' ', $key); $key = str_replace('id', 'ID', $key); $key = str_replace('ip', 'IP', $key); $key = ucfirst($key); $key = htmlspecialchars($key); echo '',"\n"; } echo '',"\n"; } echo $tr_data[$count & 1],"\n"; $td_data = sprintf('class="pme-cell-%d"', $count & 1); $i = 0; foreach ($row as $key => $value) { $td_props = $td_data; if ($i == 0) { $td_props .= ' rowspan="2" valign="middle" align="center"'; } if ($key == 'ip') { $out_data = "$value"; } elseif ($key == 'session_id' && $row['status'] == 'online') { $out_data = 'PROTECTED'; } else { $out_data = htmlspecialchars($value); } strlen($out_data) <= 0 && $out_data = ' '; echo "\n"; $i++; } echo "\n"; echo $tr_data[$count & 1], "\n"; echo ''; echo "\n"; $count++; } echo '
No sessions in database.
',$key,'
$out_data
',$user_agent,'
',"\n"; mysqli_free_result($result); if (stristr($ezin_cfg['admin_buttons_pos'], 'D') || ! stristr($ezin_cfg['admin_buttons_pos'], 'U')) { echo '
',"\n"; ezin_admin_sessions_limit_field($limit, 'down'); } echo '',"\n"; return true; } /* }}} */ function ezin_admin_sessions_limit_field($limit, $pos) /* {{{ */ { $text_name = "limit_$pos"; $submit_name = "refresh_$pos"; echo '',"\n"; echo '',"\n",'
',"\n"; echo ''; echo '',"\n"; echo 'Rows count (0 = unlimited):'; echo '  '; echo '
'; } /* }}} */ /* * Main stuff */ if (ezin_admin_check_full_list_privileges($ezin_user['role_sessions'])) { ezin_check_db_handle(); ezin_admin_sessions_main(0); ezin_close_db_connection(); } elseif (ezin_admin_check_restricted_list_privileges($ezin_user['role_sessions'])) { ezin_check_db_handle(); ezin_admin_sessions_main(1); ezin_close_db_connection(); } else { require 'inc-html/permdenied.html'; } /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=0: * }}} */ ?>