<?
require("config.php");
$top_rank=stripslashes($_POST['top_rank']);
$top_rank=clean_var($top_rank);
if($muweb['connection']=='odbc'){
$db = &ADONewConnection('odbc');
$connect_mssql = $db->Connect(Ranking,$muweb['dbuser'],$muweb['dbpassword']);
if (!$connect_mssql) die("<img src=../images/warning.gif> Connection with SQL Server With Odbc $muweb[odbc_link] failed!<br>Please check if odbc $muweb[database] exist or db user and password are okey.");
}
elseif($muweb['connection']=='mssql'){
$db = &ADONewConnection('mssql');
$connect_mssql = $db->Connect($muweb['dbhost'],$muweb['dbuser'],$muweb['dbpassword'],Ranking);
if (!$connect_mssql) die("<img src=images/warning.gif> Connection with SQL Server failed! Error #119");
}
$query = "SELECT top $top_rank charactername,class,point from event_info order by Point desc";
$result = $db->Execute($query);
$content ='<br><span class="normal_text_white">Топ '.$top_rank.' Devil Square</span></br><br> </br>
<table class="sort-table" id="table-1" cellspacing=0 cellpadding=0 width=181 border=0 >
<thead><tr>
<td class=thead2>#</td>
<td class=thead2>Име</td>
<td class=thead2>Клас</td>
<td class=thead2>Точки</td>
</tr></thead>';
for($i=0;$i < $result->numrows();++$i)
{
$row = $result->fetchrow();
if($row[2]==NULL){$row[2]="0";}
$rank = $i+1;
if($row[1] == 0){ $row[1] ='DW';
}
if($row[1] == 1){ $row[1] ='SM';
}
if($row[1] == 16){ $row[1] ='DK';
}
if($row[1] == 17){ $row[1] ='BK';
}
if($row[1] == 32){ $row[1] ='ELF';
}
if($row[1] == 33){ $row[1] ='ME';
}
if($row[1] == 48){ $row[1] ='MG';
}
$content .="<tbody><tr>
<td align=left><font color='#CCCCCC'>$rank</font></td>
<td align=left><div class='link_rankings'><a href=index.php?op=character&character=$row[0]>$row[0]</a></div></td>
<td align=left><font color='#CCCCCC'>$row[1]</font></td>
<td align=left><font color='#CCCCCC'>$row[2]</font></td>
</tr></tbody>";
}
$content .="</table>";
show($content);
?>