<?
include("config.php");
$query = "SELECT TOP 3 Name,Class,cLevel,Resets,MapNumber,AccountID,Money,PkCount,VIP from Character order by Resets desc, cLevel desc, vip desc";
$result = mssql_query($query);
echo '<center>
<table height=10 border="0" cellpadding="0" cellspacing="0" width="540" bordercolor=#666666 >
<tr>
<td valign=top align=center width=10><strong><font color=#000000>Rank</strong></td>
<td valign=top align=center width=10><strong><font color=#000000>Name</strong></td>
<td valign=top align=center width=20><strong><font color=#000000>Class</strong></td>
<td valign=top align=center width=30><strong><font color=#000000>Level</strong></td>
<td valign=top align=center width=20><strong><font color=#000000>Resets</strong></td>
<td valign=top align=center width=20><strong><font color=#000000>Money</strong></td>
<td valign=top align=center width=20><strong><font color=#000000>PK</strong></td>
<td valign=top align=center width=20><strong><font color=#000000>VIP</strong></td>
</tr>';
for($i=0;$i < mssql_num_rows($result);++$i)
{
$row = mssql_fetch_row($result);
$query2="Select ConnectStat from MEMB_STAT where memb___id='$row[5]'";
$result2 = mssql_query($query2);
$row2 = mssql_fetch_row($result2);
$rank = $i+1;
if($row[1] == 0){ $row[1] ='<a href="?op=rankings&requested=resets&classes=dw&page=1"><font color=$color1>DW</font>';
}
if($row[1] == 1){ $row[1] ='<a href="?op=rankings&requested=resets&classes=sm&page=1"><font color=$color1>SM</font>';
}
if($row[1] == 16){ $row[1] ='<a href="?op=rankings&requested=resets&classes=dk&page=1"><font color=$color1>DK</font>';
}
if($row[1] == 17){ $row[1] ='<a href="?op=rankings&requested=resets&classes=bk&page=1"><font color=$color1>BK</font>';
}
if($row[1] == 32){ $row[1] ='<a href="?op=rankings&requested=resets&classes=elf&page=1"><font color=$color1>ELF</font>';
}
if($row[1] == 33){ $row[1] ='<a href="?op=rankings&requested=resets&classes=me&page=1"><font color=$color1>ME</font>';
}
if($row[1] == 48){ $row[1] ='<a href="?op=rankings&requested=resets&classes=mg&page=1"><font color=$color1>MG</font>';
}
if($row[1] == 64){ $row[1] ='<a href="?op=rankings&requested=resets&classes=dl&page=1"><font color=$color1>DL</font>';
}
if($rank == 1) { $color = 'red'; } else { $color='white'; }
echo "<tr><td valign=top align=center width=10><font color=$color>$rank</td>
<td valign=top align=center width=20><a href='whoiz.php?name=$row[0]'><font color=$color>$row[0]</td>
</td>
<td valign=top align=center width=30><font color=$color>$row[1]</td>
<td valign=top align=center width=30><font color=$color>$row[2]</td>
<td valign=top align=center width=30><font color=$color>$row[3]</td>
<td valign=top align=center width=30><font color=$color>$row[6]</td>
<td valign=top align=center width=30><font color=$color>$row[7]</td>
<td valign=top align=center width=30><font color=$color>$row[8]</td>
</tr>
</center>";
}
?>