
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Top 50 Players</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />

	</head>
	<body>
		<div id="wrapper">
			<div id="header"></div>
			
			<div id="menu">
            <a class="link" href="/index.php">Home</a><img src="images/devider.png" />
				<a class="link" href="http://siestaonline.boards.net/index.cgi?">Forums</a><img src="images/devider.png" />
				<a class="link" href="/signup.php">Register</a><img src="images/devider.png" />
				<a class="link" href="/download.php">Download</a><img src="images/devider.png" />
				<a class="link" href="/contactus.php">Contact Us</a>
			</div>
			
			<div id="main">
			  <div id="sidebar"><br />
                            <div class="title"><a href="Top50-2.php">Top 50 Players</a></div><br />
	
			    <div class="title"><a href="serverinfo.php">Connection Guide</a></div>
			    <br />
			    <div class="title"><a href="vote.php">Vote4Us</a></div>
			    <br />
                <div class="title"><a href="/Patchnotes.txt">Patch Notes</a></div>
			    <br />
			    			    <div class="title"><a href="/ToS.txt">Terms of Service</a></div>
			    <br />
			    <div class="title">Server Information</div>
			    <br />
			    <p align="center"> <b>Experience:</b> 100x<br />
			      <b>Item Drop:</b> 15x<br />
		        </p>
			    <p align="center"> <b>Starting money: 100s</b></p>
					<p align="center"><strong>Server Status: Online</strong><br />
                    <!--<p align="center"><strong>Server Status: Offline</strong><br />-->
		        </p>
			    <div align="center"></div>
		      </div>
			  <div id="content">
	        <h3 align="center">Order by:</h3>
	        <div align="center">
	          <pre><a href="Top50-1.php">Experience</a>		<a href="Top50-2.php">Level</a>		<a href="Top50-3.php">Kill Points</a></pre></div>
	        <?php  

    // CONFIG 
    $odbc_host = 'xxxx\SQLExpress'; 
    $odbc_user = 'xxxx'; 
    $odbc_pass = 'xxxx'; 
    // CONFIG END 
     
    echo '<h1><center>Top 50 Players</h1></center>'; 
    $odbc_link = odbc_connect ( "Driver={SQL Server};Server=".$odbc_host.";Database=World00_Character;" , $odbc_user , $odbc_pass ); 
     
    $sql[1] = 'SELECT TOP 50 nCharNo, sID, nExp , nLevel , nPKCount FROM tCharacter WHERE nAdminLevel = 0 AND bDeleted = 0 ORDER  BY nLevel DESC'; 
    $rs[1] = odbc_exec ( $odbc_link , $sql[1] ); 
    if ( !$rs[1] ) 
        { 
        exit ( 'Error in SQL' ); 
        } 
     
    $i = 1; 
         
    echo '<table width="100%">'; 
    echo '    <tr>'; 
    echo '        <td>'; 
    echo '            <h3>#</h3>'; 
    echo '        </td>'; 
    echo '        <td>'; 
    echo '            <h3>Name</h3>'; 
    echo '        </td>'; 
    echo '        <td>'; 
    echo '           <h3> Exp</h3>'; 
    echo '        </td>'; 
    echo '        <td>'; 
    echo '            <h3>Level</h3>'; 
    echo '        </td>'; 
	echo '        <td>'; 
    echo '            <h3>Kill Points</h3>'; 
    echo '        </td>'; 
    echo '        <td>'; 
    echo '            <h3>Class</h3>'; 
    echo '        </td>'; 
    echo '        <td>'; 
    echo '            <h3>Guild</h3>'; 
    echo '        </td>'; 
    echo '    </tr>'; 
    while ( odbc_fetch_row ( $rs[1] ) ) 
        { 
        $sID = odbc_result ( $rs[1] , 'sID' ); 
        $nExp = odbc_result ( $rs[1] , 'nExp' ); 
        $nLevel = odbc_result ( $rs[1] , 'nLevel' ); 
		$nPKCount = odbc_result ( $rs[1] , 'nPKCount' );		
        $nName = 'No Guild'; 
        $sID = str_replace ( 'ä' , '&auml;' , str_replace ( 'Ä' , '&Auml;' , str_replace ( 'ö' , '&ouml;' , str_replace ( 'Ö' , '&Ouml;' , str_replace ( 'ü' , '&uuml;' , str_replace ( 'Ü' , '&Uuml;' , str_replace ( 'ß' , '&szlig;' , $sID ) ) ) ) ) ) ); 
         
        $nCharNo = odbc_result ( $rs[1] , 'nCharNo' ); 
         
        $sql[2] = 'SELECT TOP 1 nNo FROM tGuildMember WHERE nCharNo = '.$nCharNo; 
        $rs[2] = odbc_exec ( $odbc_link , $sql[2] ); 
        if ( !$rs[2] ) 
            { 
            exit ( 'Error in SQL' ); 
            } 
        while ( odbc_fetch_row ( $rs[2] ) ) 
            { 
            $nNo = odbc_result ( $rs[2] , 'nNo' ); 
            $sql[3] = 'SELECT TOP 1 sName FROM tGuild WHERE nNo = '.$nNo; 
            $rs[3] = odbc_exec ( $odbc_link , $sql[3] ); 
            while ( odbc_fetch_row ( $rs[3] ) ) 
                { 
                $nName = odbc_result ( $rs[3] , 'sName' ); 
                } 
            } 
             
        $sql[4] = 'SELECT TOP 1 nClass FROM tCharacterShape WHERE nCharNo = '.$nCharNo; 
        $rs[4] = odbc_exec ( $odbc_link , $sql[4] ); 
        if ( !$rs[4] ) 
            { 
            exit ( 'Error in SQL' ); 
            } 
        while ( odbc_fetch_row ( $rs[4] ) ) 
            { 
            $nClass = odbc_result ( $rs[4] , 'nClass' ); 
            } 
         
        switch ($nClass) 
            { 
            //Krieger 
            case 1: 
                $nClass = 'Fighter'; 
                break; 
            case 2: 
                $nClass = 'Clever Fighter'; 
                break; 
            case 3: 
                $nClass = 'Warrior'; 
                break; 
            case 4: 
                $nClass = 'Gladiator'; 
                break; 
            case 5: 
                $nClass = 'Knight'; 
                break; 
             
            //Priester     
            case 8: 
                $nClass = 'Cleric'; 
                break; 
            case 9: 
                $nClass = 'High Cleric'; 
                break; 
            case 10: 
                $nClass = 'Paladin'; 
                break; 
            case 11: 
                $nClass = 'Holy Knight'; 
                break; 
            case 12: 
                $nClass = 'Guardian'; 
                break; 
             
            //Jäger     
            case 15: 
                $nClass = 'Archer'; 
                break; 
            case 16: 
                $nClass = 'Hawk Archer'; 
                break; 
            case 17: 
                $nClass = 'Scout'; 
                break; 
            case 18: 
                $nClass = 'SharpShooter'; 
                break; 
            case 19: 
                $nClass = 'Ranger'; 
                break; 
             
            //Magier     
            case 22: 
                $nClass = 'Mage'; 
                break; 
            case 23: 
                $nClass = 'WizMage'; 
                break; 
            case 24: 
                $nClass = 'Enchanter'; 
                break; 
            case 25: 
                $nClass = 'Warlock'; 
                break; 
            case 26: 
                $nClass = 'Wizard'; 
                break; 
             
            //Standart     
            default: 
                $nClass = 'No Class'; 
                break; 
            } 
         
        echo '    <tr>'; 
        echo '        <td>'; 
        echo '            '.$i; 
        echo '        </td>'; 
        echo '        <td>'; 
        echo '            '.$sID; 
        echo '        </td>';  
        echo '        <td>'; 
        echo '            '.$nExp;   
        echo '        </td>'; 
        echo '        <td>'; 
        echo '            '.$nLevel; 
        echo '        </td>'; 
		echo '        <td>'; 
        echo '            '.$nPKCount;   
        echo '        </td>'; 
        echo '        <td>'; 
        echo '            '.$nClass; 
        echo '        </td>'; 
        echo '        <td>'; 
        echo '            '.$nName; 
        echo '        </td>'; 
        echo '    </tr>'; 
         
        $i++; 
        } 
         
    odbc_close ( $odbc_link ); 
     
    echo '</table>'; 

?>
			  </div>
			</div>
			
			<div id="footer">(C) 2012. All rights are reserved.<br />
			  Design by DanSpd,   Nostalgia, Black12.</div>
		</div>
	</body>
</html>