<?php include('inc/header.php'); ?>
<meta http-equiv="refresh" content="10; URL=list_online.php">
<h1>Listen - Spielerübersicht</h1>
<div class="container">
<?php
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 MultiServer ASC, m_szName ASC');
$select2 = odbc_exec($odbc_connect, 'SELECT * FROM [CHARACTER_TBL] WHERE MultiServer > 0 AND m_chAuthority != \'F\' order by MultiServer ASC, m_szName ASC');
$normal = odbc_num_rows($select1);
$staff = odbc_num_rows($select2);
if($staff == 0 AND $normal == 0) {
    echo '<h2>Spieler, die gerade online sind</h2>';
}
// Staff
if($staff > 0){
    echo '
<h2>Teammitglieder: <b>'.$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"><a href="search.php?search='.$result['m_szName'].'&character">'.$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>
<br />';
}
// Normal
if($normal > 0) {
    echo '
<h2>Spieler: <b>'.$normal.'</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($select1)) {
        $auth = $result['m_chAuthority'];
        echo '
		<tr class="row">
			<td><a href="search.php?search='.$result['m_szName'].'&character">'.utf8_encode($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>';
}
?>
</div>
<?php include('inc/footer.php'); ?>