<?php include('inc/header.php'); ?>
    <meta http-equiv="refresh" content="10; URL=list_onlineplayer.php">
<?php
echo '<h1>Listen / Logs - Spielerübersicht</h1>';
odbc_exec($odbc_connect, 'USE [' . $_CONFIG['db_databases']['chr'] . ']');
$select1 = odbc_exec($odbc_connect, 'SELECT * FROM [CHARACTER_TBL] WHERE MultiServer > 0 AND m_chAuthority = \'F\' order by m_szName ASC, MultiServer ASC');
$select2 = odbc_exec($odbc_connect, 'SELECT * FROM [CHARACTER_TBL] WHERE MultiServer > 0 AND m_chAuthority != \'F\' order by m_szName ASC, MultiServer ASC');
$normal = odbc_num_rows($select1);
$staff = odbc_num_rows($select2);
if($staff == 0 AND $normal == 0) {
    echo '<h2>'.$lang['op_no_online'].'</h2>';
}
// Staff
if($staff > 0){
    echo '
<h2><b>'.$lang['op_staff'].': '.$staff.'</b></h2>
<table cellspacing="0">
	<thead>
		<tr>
			<td>Charakter</td>
			<td>Jobklasse</td>
			<td>Level</td>
			<td>Channel</td>
		</tr>
	</thead>
	<tbody>';
    while($result = odbc_fetch_array($select2)) {
        $auth = $result['m_chAuthority'];
        echo '
		<tr>
			<td width="200px">'.getColor($auth, $result['m_szName']).'</td>
			<td>'.getColor2($auth, $job[$result['m_nJob']]).'</td>
			<td>'.getColor2($auth, $result['m_nLevel']).'</td>
			<td>'.getColor2($auth, getChannel($result['MultiServer'])).'</td>
		</tr>';
    }
    echo '
	</tbody>
</table>
<br />';
}
// Normal
if($normal > 0) {
    echo '
<h2>Derzeit sind <b>'.$normal.'</b> Spieler online</h2>
<table cellspacing="0">
	<thead>
		<tr>
			<td>Charakter</td>
			<td>Jobklasse</td>
			<td>Level</td>
			<td>Channel</td>
		</tr>
	</thead>
	<tbody>';
    while($result = odbc_fetch_array($select1)) {
        $auth = $result['m_chAuthority'];
        echo '
		<tr class="row">
			<td><a href="account_users.php?inputField='.$result['m_szName'].'&char">'.$result['m_szName'].'</a></td>
			<td>'.$job[$result['m_nJob']].'</td>
			<td>'.$result['m_nLevel'].'</td>
			<td>'.getChannel($result['MultiServer']).'</td>
		</tr>';
    }
    echo '
	</tbody>
</table>';
}
?>
<?php include('inc/footer.php'); ?>