<center><?php
require 'config.php';
$query = 'Select memb___id, ConnectTM, ConnectTm From MEMB_STAT where Connectstat=1 order by ConnectTM desc';
$result = mssql_query( $query );
echo '<TABLE border=0 cellPadding=2 cellSpacing=2>
<table id="mutable" class="alt5" height=30 border="1" bordercolor="333333" cellpadding="0" cellspacing="1" >
<tr>
<td align=center><font color=#545454><b>ID</b></font></td>
<td align=center><font color=#545454><b>Герой</b></font></td>
<td align=center><font color=#545454><b>В игра от</b></font></td>
<td align=center><font color=#545454><b>Ниво</b></font></td>
<td align=center><font color=#545454><b>Ресове</b></font></td>
<td align=center><font color=#545454><b>Местоположение</b></font></td>
</tr>';
$waw = mssql_query("SELECT count(*) From MEMB_STAT where Connectstat=1");
$xex = mssql_result($waw, 0, 0);
$color = 'darkblue';
for($i=0;$i < $xex;++$i)
{
$row = mssql_fetch_row($result);
$querychar = "Select GameIDC From AccountCharacter where Id='$row[0]'";
$resultchar = mssql_query( $querychar );
$accchar = mssql_fetch_row($resultchar);
$querychar = "Select Name,Class,MapNumber,clevel,resets From Character where Name='$accchar[0]'";
$resultchar = mssql_query( $querychar );
$charr = mssql_fetch_row($resultchar);
$rank = $i+1;
//Class
if ($charr['1'] == 0) { $charr[1] = "Dark Wizard"; }
if ($charr['1'] == 1) { $charr[1] = "Soul Master"; }
if ($charr['1'] == 16) { $charr[1] = "Dark Knight"; }
if ($charr['1'] == 17) { $charr[1] = "Blade Knight"; }
if ($charr['1'] == 32) { $charr[1] = "Elf"; }
if ($charr['1'] == 33) { $charr[1] = "Muse Elf"; }
if ($charr['1'] == 48) { $charr[1] = "Magic Gladiator"; }
//Location
if ($charr['2'] == 0) { $charr[2] = 'Lorencia'; }
if ($charr['2'] == 1) { $charr[2] = 'Dungeon'; }
if ($charr['2'] == 2) { $charr[2] = 'Davias'; }
if ($charr['2'] == 3) { $charr[2] = 'Noria'; }
if ($charr['2'] == 4) { $charr[2] = 'Lost tower'; }
if ($charr['2'] == 5) { $charr[2] = 'Excile'; }
if ($charr['2'] == 6) { $charr[2] = 'Arena'; }
if ($charr['2'] == 7) { $charr[2] = 'Atlans'; }
if ($charr['2'] == 8) { $charr[2] = 'Tarkan'; }
if ($charr['2'] == 9) { $charr[2] = 'Devil Square'; }
if ($charr['2'] == 32) { $charr[2] = 'Devil Square'; }
if ($charr['2'] == 10) { $charr[2] = 'Icarus'; }
if ($charr['2'] == 11) { $charr[2] = 'Blood castle 1'; }
if ($charr['2'] == 12) { $charr[2] = 'Blood castle 2'; }
if ($charr['2'] == 13) { $charr[2] = 'Blood castle 3'; }
if ($charr['2'] == 14) { $charr[2] = 'Blood castle 4'; }
if ($charr['2'] == 15) { $charr[2] = 'Blood castle 5'; }
if ($charr['2'] == 16) { $charr[2] = 'Blood castle 6'; }
if ($charr['2'] == 17) { $charr[2] = 'Blood castle 7'; }
if ($charr['2'] == 18) { $charr[2] = 'Chaos castle 1'; }
if ($charr['2'] == 19) { $charr[2] = 'Chaos castle 2'; }
if ($charr['2'] == 20) { $charr[2] = 'Chaos castle 3'; }
if ($charr['2'] == 21) { $charr[2] = 'Chaos castle 4'; }
if ($charr['2'] == 22) { $charr[2] = 'Chaos castle 5'; }
if ($charr['2'] == 23) { $charr[2] = 'Chaos castle 6'; }
if ($charr['2'] == 24) { $charr[2] = 'Kalima 1'; }
if ($charr['2'] == 25) { $charr[2] = 'Kalima 2'; }
if ($charr['2'] == 26) { $charr[2] = 'Kalima 3'; }
if ($charr['2'] == 27) { $charr[2] = 'Kalima 4'; }
if ($charr['2'] == 28) { $charr[2] = 'Kalima 5'; }
if ($charr['2'] == 29) { $charr[2] = 'Kalima 6'; }
if ($charr['2'] == 36) { $charr[2] = 'Kalima 7'; }
if ($charr['2'] == 30) { $charr[2] = 'Valery Of Loren'; }
if ($charr['2'] == 31) { $charr[2] = 'Land of Trial'; }
if ($charr['2'] == 33) { $charr[2] = 'Aida'; }
if ($charr['2'] == 34) { $charr[2] = 'Cry Wolf'; }
if ($charr['2'] == 35) { $charr[2] = 'Silent Map'; }
if ($charr['2'] == 37) { $charr[2] = 'Kanturu Ruin'; }
if ($charr['2'] == 38) { $charr[2] = 'Kanturu Remain'; }
if ($charr['2'] == 39) { $charr[2] = 'Kanturu Tower'; }
echo "<tr>
<td align=center><font size=1 color=#545454><b>$rank.</b></font></td>
<td align=center><font size=1 color=#999999><b>$accchar[0]</b></td>
<td align=center><font size=1 color=#39b44a>$row[2]</td>
<td align=center><font size=1 color=#FFFFFF><b>$charr[3]</b></td>
<td align=center><font size=1 color=#545454><b>[<font color=#e11616><b>$charr[4]</b></font>]</b></td>
<td align=center><font size=1 color=#545454><b>$charr[2]</b></td>
</tr>
";
}
?></center>
</table>