<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

echo "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\r\n<title>MuSylphid</title>\r\n<link href=\"estilo.css\" rel=\"stylesheet\" type=\"text/css\">\r\n<style type=\"text/css\">\r\n<!--\r\nbody,td,th {\r\n\tfont-size: 14px;\r\n\tfont-family: Arial, Helvetica, sans-serif;\r\n}\r\n.style78 {\r\n\tfont-size: 10px;\r\n\tcolor: #333333;\r\n}\r\n-->\r\n\r\n</style>\r\n<style type=\"text/css\">\r\n<!--\r\n  .formata { /* esta classe é somente \r\n               para formatar a fonte */\r\n  font: 12px arial, verdana, helvetica, sans-serif; \r\n  }\r\n  a.dcontexto{\r\n  position:relative; \r\n  font:12px arial, verdana, helvetica, sans-serif; \r\n  padding:0;\r\n  color:#039;\r\n  text-decoration:none;\r\n  cursor:help; \r\n  z-index:24;\r\n  }\r\n  a.dcontexto:hover{\r\n  background:transparent;\r\n  z-index:25; \r\n  }\r\n  a.dcontexto span{display: none}\r\n  a.dcontexto:hover span{ \r\n  display:block;\r\n  position:absolute;\r\n  width:250px; \r\n  top:2em;\r\n  text-align:justify;\r\n  left:-3em;\r\n  font: 12px arial, verdana, helvetica, sans-serif; \r\n  padding:5px 10px;\r\n  border:1px solid #999;\r\n  background:#e0ffff; \r\n  color:#000;\r\n  }\r\n  -->\r\n</style>\r\n</head>\r\n\r\n<body background=\"../images/preto1.gif\" topmargin=\"0\">\r\n\r\n";
$o = º;
include( "config.php" );
include( "paginator.php" );
$sql = mssql_query( "SELECT count(*) FROM MEMB_STAT WHERE ConnectStat=1" );
$num_rows = mssql_result( $sql, 0, 0 );
$a =& new paginator( $_GET['page'], $num_rows );
if ( $topnumber == "" )
{
    $topnumber = 35;
}
$a->set_limit( $topnumber );
$a->set_links( 5 );
$limit1 = $a->getrange1( );
$limit2 = $a->getrange2( );
$query = "SELECT TOP ";
$query .= $limit1 + $limit2;
$query .= " memb___id, ServerName, ConnectTM FROM MEMB_STAT WHERE ConnectStat=1";
echo "<div align=\"center\">\r\n<table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr> \r\n    <td width=\"5%\" align=\"center\" class=\"rankcategoria\">Pos</td>\r\n    <td width=\"14%\" align=\"center\" class=\"rankcategoria\">Personagem</td>\r\n    <td width=\"14%\" align=\"center\" class=\"rankcategoria\">Mapa</td>\r\n    <td width=\"7%\" align=\"center\" class=\"rankcategoria\">Level</td>\r\n    <td width=\"7%\" align=\"center\" class=\"rankcategoria\">Resets</td>\r\n    <td width=\"8%\" align=\"center\" class=\"rankcategoria\">Resetão</td>\r\n    <td width=\"8%\" align=\"center\" class=\"rankcategoria\">Conta</td>\r\n    <td width=\"17%\" align=\"center\" class=\"rankcategoria\">Tempo</td>\r\n  </tr>\r\n";
$result = mssql_query( $query );
$i = 0;
for ( ; $i < $limit1; ++$i )
{
    $row = mssql_fetch_row( $result );
}
$j = 0;
for ( ; $j < mssql_num_rows( $result ) - $limit1; ++$j )
{
    $row = mssql_fetch_row( $result );
    $qChar = @mssql_query( "SELECT GameIDC FROM AccountCharacter WHERE Id='".$row[0]."'" );
    $Char = @mssql_result( $qChar, 0, 0 );
    $qInfoChar = @mssql_query( "SELECT cLevel, MapNumber, resetao, MapPosY, Resets FROM Character WHERE Name='".$Char."'" );
    $InfoChar = @mssql_fetch_row( $qInfoChar );
    switch ( $InfoChar[1] )
    {
    case 0 :
        $mapa = "Lorencia";
        break;
    case 1 :
        $mapa = "Dungeon";
        break;
    case 2 :
        $mapa = "Devias";
        break;
    case 3 :
        $mapa = "Noria";
        break;
    case 4 :
        $mapa = "Lost Tower";
        break;
    case 5 :
        $mapa = "Exile";
        break;
    case 6 :
        $mapa = "Arena";
        break;
    case 7 :
        $mapa = "Atlans";
        break;
    case 8 :
        $mapa = "Tarkan";
        break;
    case 9 :
        $mapa = "Devil Square";
        break;
    case 10 :
        $mapa = "Icarus";
        break;
    case 11 :
        $mapa = "Blood Castle 1";
        break;
    case 12 :
        $mapa = "Blood Castle 2";
        break;
    case 13 :
        $mapa = "Blood Castle 3";
        break;
    case 14 :
        $mapa = "Blood Castle 4";
        break;
    case 15 :
        $mapa = "Blood Castle 5";
        break;
    case 16 :
        $mapa = "Blood Castle 6";
        break;
    case 17 :
        $mapa = "Blood Castle 7";
        break;
    case 18 :
        $mapa = "Chaos Castle 1";
        break;
    case 19 :
        $mapa = "Chaos Castle 2";
        break;
    case 20 :
        $mapa = "Chaos Castle 3";
        break;
    case 21 :
        $mapa = "Chaos Castle 4";
        break;
    case 22 :
        $mapa = "Chaos Castle 5";
        break;
    case 23 :
        $mapa = "Chaos Castle 6";
        break;
    case 24 :
        $mapa = "Kalima 1";
        break;
    case 25 :
        $mapa = "Kalima 2";
        break;
    case 26 :
        $mapa = "Kalima 3";
        break;
    case 27 :
        $mapa = "Kalima 4";
        break;
    case 28 :
        $mapa = "Kalima 5";
        break;
    case 29 :
        $mapa = "Kalima 6";
        break;
    case 31 :
        $mapa = "Valey of Loren";
        break;
    case 32 :
        $mapa = "Land of Trial";
        break;
    case 33 :
        $mapa = "Aida";
        break;
    case 34 :
        $mapa = "Cry Wolf";
    }
    $query_check_vip = mssql_query( "SELECT vip FROM MEMB_INFO WHERE memb___id='".$row['0']."'" );
    $check_vip = mssql_fetch_row( $query_check_vip );
    if ( $check_vip[0] == 0 )
    {
        $vip = "<font color='red'><b>N&atilde;o</b></font>";
    }
    if ( $check_vip[0] == 1 )
    {
        $vip = "<font color='#00FF00'><b>Sim</b></font>";
    }
    $rank = $i + $j + 1;
    echo " \t<tr>\r\n\t\t<td align=\"left\" class=\"rankresultado\"><b>";
    echo $rank;
    echo $o;
    echo "</b></td>\r\n\t    <td align=\"left\" class=\"rankresultado\">";
    echo $Char;
    echo "</td>\r\n\t\t<td align=\"left\" class=\"rankresultado\">";
    echo $mapa;
    echo "</td>\r\n\t    <td align=\"center\" class=\"rankresultado\">";
    echo $InfoChar[0];
    echo "</td>\r\n\t    <td align=\"center\" class=\"rankresultado\">";
    echo $InfoChar[4];
    echo "</td>\r\n\t\t<td align=\"center\" class=\"rankresultado\">";
    echo $InfoChar[2];
    echo "</td>\r\n\t\t<td align=\"center\" class=\"rankresultado\">";
    echo $vip;
    echo "</td>\r\n\t\t<td align=\"left\" class=\"rankresultado\">";
    echo $row[2];
    echo "</td>\r\n\t</tr>";
}
echo "     </table>\r\n<br>\r\n";
if ( $a->getcurrent( ) == 1 )
{
    $first = "<font class=\"ranktexto\">Primeira | </font>";
}
else
{
    $first = "<a href=\"".$a->getpagename( )."?pagina=online&page=".$a->getfirst( )."\" class=\"rank\">Primeira</a> |";
}
if ( $a->getprevious( ) )
{
    $prev = "<a href=\"".$a->getpagename( )."?pagina=online&page=".$a->getprevious( )."\" class=\"rank\">Anterior</a> | ";
}
else
{
    $prev = "<font class=\"ranktexto\">Anterior | </font>";
}
if ( $a->getnext( ) )
{
    $next = "<a href=\"".$a->getpagename( )."?pagina=online&page=".$a->getnext( )."\" class=\"rank\">Próxima</a> | ";
}
else
{
    $next = "<font class=\"ranktexto\">Próxima | </font>";
}
if ( $a->getlast( ) )
{
    $last = "<a href=\"".$a->getpagename( )."?pagina=online&page=".$a->getlast( )."\" class=\"rank\">Última</a>";
}
else
{
    $last = "<font class=\"ranktexto\">Última</font>";
}
echo "<font class=\"ranktexto\"> de ".$a->getfirstof( )." até ".$a->getsecondof( )." - Total de ".$a->gettotalitems( )." </font>| ";
echo $first." ".$prev." ".$next." ".$last;
echo "<br>";
if ( $a->getprevious( ) )
{
    echo "<a href=\"".$a->getpagename( )."?pagina=online&page=".$a->getprevious( )."\" class=\"rank\">Anterior</a> ";
}
$links = $a->getlinkarr( );
$current = $a->getcurrent( );
foreach ( $links as $link )
{
    if ( $link == $current )
    {
        echo " <font class=\"ranktexto\">".$link."</font> ";
    }
    else
    {
        echo "<a href=\"".$a->getpagename( ).( "?pagina=online&page=".$link."\" class=\"rank\">" ).$link."</a> ";
    }
}
if ( $a->getnext( ) )
{
    echo "<a href=\"".$a->getpagename( )."?pagina=online&page=".$a->getnext( )."\" class=\"rank\">Proxima</a> ";
}
echo "\r\n</body>\r\n</html>";
?>
