<table class="default_h" cellspacing="0" cellpadding="2">
   <td class="head" colspan="4" ><?php echo lang_medals_title_general; ?></td>
    <tbody>
 <?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BC2 Server Stats                                        # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernt werden                      # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BC2 Server Stats is a free Software-------------# ||
|| #                      http://eot-clan.net                         # ||
|| #################################################################### ||
\*======================================================================*/
if (!defined('INCLUDE_ME')){ 
die('access not allowed'); 
}
  $sSql = "SELECT 
      a.SoldierName,
      a.PlayerID,
      a.ClanTag,
      b.playerKills / b.playerDeaths AS KD  
  FROM tbl_playerdata a
      Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
  WHERE 
     TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
     AND b.playerRounds >= 20
  ORDER by 
     KD DESC LIMIT 3"; 
 $result = db_query($sSql);
 
$tipKD = '<img src=img/medals/KD.png border=0 width=100px /><br />'.lang_medals_text1.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipKD; ?>',TITLE, '<?php echo lang_medals_title1; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/KD.png" border="0" width="60px" /></a>
	<br />
<?php

while($sSoldier = mysql_fetch_assoc($result)) {
	        if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	         
	?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['KD'], 2, '.', ' '); ?></span>)<br />
	<?php
}


$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           a.PlayerID, 
           b.playerHeadshots / b.playerRounds AS HspR 
         FROM tbl_playerdata a
           Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
           AND b.playerRounds >= 20
         ORDER by
          HspR DESC Limit 3";
	$result = db_query($sSql);
	$tipHS = '<img src=img/medals/HS.png border=0 width=100px /><br />'.lang_medals_text2.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipHS; ?>',TITLE, '<?php echo lang_medals_title2; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/HS.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['HspR'], 2, '.', ' '); ?></span>)<br />
	<?php
}

$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           b.playerKills / b.playerRounds AS KPR
         FROM tbl_playerdata a
           Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
           AND b.playerRounds >= 20
         ORDER by
          KPR DESC Limit 3";
	$result = db_query($sSql);
	
	$tipKPR = '<img src=img/medals/KPR.png border=0 width=100px /><br />'.lang_medals_text7.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipKPR; ?>',TITLE, '<?php echo lang_medals_title7; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/KPR.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['KPR'], 2, ',', ' '); ?></span>)<br />
	<?php
}


$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           a.PlayerID, 
           b.playerScore / b.playerRounds AS PpR
         FROM tbl_playerdata a
           Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
           AND b.playerRounds >= 20
         ORDER by
          PpR DESC Limit 3";
	$result = db_query($sSql);
	
	$tipHS = '<img src=img/medals/PPR.png border=0 width=100px /><br />'.lang_medals_text3.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipHS; ?>',TITLE, '<?php echo lang_medals_title3; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/PPR.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['PpR'], 0, ',', ' '); ?></span>)<br />
	<?php
}


echo '<tr>';

$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           b.playerPlaytime
         FROM tbl_playerdata a
           Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
         ORDER by
          b.playerPlaytime DESC Limit 3";
	$result = db_query($sSql);
	
	$tipTIME = '<img src=img/medals/TIME.png border=0 width=100px /><br />'.lang_medals_text4.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipTIME; ?>',TITLE, '<?php echo lang_medals_title4; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/TIME.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
	        $pTime = $time = sprintf("%02dh",$sSoldier['playerPlaytime']/60/60);
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo $pTime; ?></span>)<br />
	<?php
}

$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           a.BonusPoints
         FROM tbl_playerdata a
           Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
         ORDER by
          a.BonusPoints DESC Limit 3";
	$result = db_query($sSql);
	
	$tipBonus = '<img src=img/medals/Bonus.png border=0 width=100px /><br />'.lang_medals_text5.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipBonus; ?>',TITLE, '<?php echo lang_medals_title5; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/Bonus.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['BonusPoints'], 0, ',', ' '); ?></span>)<br />
	<?php
}


$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           c.40MMGL_kills+c.RPG7_kills+c.M2CG_kills+c.M136_kills+c.`ATM-00_kills`+c.`DTN-4_kills`+c.`HG-2_kills`+c.TNTV_kills AS boom
         FROM tbl_playerdata a
           Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
           Left JOIN tbl_weaponstats c ON a.PlayerID = c.WeaponStatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
         ORDER by
          boom DESC Limit 3";
	$result = db_query($sSql);
	
	$tipboom = '<img src=img/medals/Boom.png border=0 width=100px /><br />'.lang_medals_text6.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipboom; ?>',TITLE, '<?php echo lang_medals_title6; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/Boom.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['boom'], 0, ',', ' '); ?></span>)<br />
	<?php
}

$sSql = "SELECT 
           a.SoldierName,
           a.ClanTag,
           c.`KNV-1_kills`
         FROM tbl_playerdata a
         Left JOIN tbl_playerstats b ON a.PlayerID = b.StatsID
           Left JOIN tbl_weaponstats c ON a.PlayerID = c.WeaponStatsID
         WHERE 
           TO_DAYS(b.LastSeenOnServer)+14 > TO_DAYS(NOW())
         ORDER by
          c.`KNV-1_kills` DESC Limit 3";
	$result = db_query($sSql);
	
	$tipknv = '<img src=img/medals/KNV.png border=0 width=100px /><br />'.lang_medals_text8.'';
?>
<td class="result" width="203px">
		<a onmouseover="Tip('<?php echo $tipknv; ?>',TITLE, '<?php echo lang_medals_title8; ?>', WIDTH, 200, CENTERMOUSE, true, OFFSETX, 0, OFFSETY, 30, TEXTALIGN, 'center', OPACITY, 96)" onmouseout="UnTip() "><img src="img/medals/KNV.png" border="0" width="60px" /></a>
	<br />
<?php
	while($sSoldier = mysql_fetch_assoc($result)){

	         if (in_array($sSoldier['ClanTag'], $ClanTag) && $ClanTag != ''){
	         	$soldier = '<span class="sonstige">'.htmlspecialchars($sSoldier['SoldierName']).'</span>';
	        }else{
	        	$soldier = htmlspecialchars($sSoldier['SoldierName']);
	       }
	        
		?> 
	<a href="ministats.php?name=<?php echo urlencode($sSoldier['SoldierName']);?>"><?php echo $soldier; ?></a> (<span class="stats_players"><?php echo number_format($sSoldier['KNV-1_kills'], 0, ',', ' '); ?></span>)<br />
	<?php
}


?>


    </tbody>
   </table>

	