<?
include "cnn.php";
include 'cnn.php'; 
$QueryListUsersOn = mssql_query("SELECT Memb___Id, ServerName FROM MEMB_STAT WHERE ConnectStat>0 and ServerName='$name' ORDER By Memb___Id ASC");
?>
<h1>Jogadores Online: <?=$name?></h1>
<div class="quadros">
  <table border='0' width='100%'>
    <tr>
      <td align='center' bgcolor='#cccccc'><strong>Personagem</strong></td>
      <td align='center' bgcolor='#cccccc'><strong>Level</strong></td>
      <td align='center' bgcolor='#cccccc'><strong>Resets</strong></td>
      <td align='center' bgcolor='#cccccc'><strong>Sala</strong></td>
    </tr>
    <? 
  for($r=0;$r<mssql_num_rows($QueryListUsersOn);$r++) {
  $rank=$r+1;
  $rListOn = mssql_fetch_row($QueryListUsersOn);
	$qGameIdc = mssql_query("SELECT GameIdc from AccountCharacter WHERE Id='".$rListOn[0]."'");
	$rGameIdc = mssql_fetch_row($qGameIdc);
	$qCharOn = mssql_query("SELECT Name,Resets,cLevel FROM Character WHERE Name='".$rGameIdc[0]."'");
	$rCharOn = mssql_fetch_row($qCharOn);
	$qPegaSala = mssql_query("SELECT ServerName FROM Memb_STAT WHERE Memb___Id='".$rListOn[0]."'");
	$rMostraSala = mssql_fetch_row($qPegaSala);
?>
    <tr>
      <td align='center' bgcolor='#E5E5E5'><b><font color="#006699">
        <?=$rGameIdc[0]?>
      </font></b></td>
      <td align='center' bgcolor='#E5E5E5'><?=$rCharOn[2]?></td>
      <td align='center' bgcolor='#E5E5E5'><?=$rCharOn[1]?></td>
      <td align='center' bgcolor='#E5E5E5'><?=$rMostraSala[0]?>      </td>
      <? } ?>
    </tr>
  </table>
</div>
