<?php
/*======================================================================*\
|| #################################################################### ||
|| # eGamers of Tomorrow Battlefield 3 Leaderboard                    # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernt werden                      # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------Teil des Bf3 Leaderboards von EoT-----------------# ||
|| #                      http://eot-clan.net                         # ||
|| #################################################################### ||
\*======================================================================*/

require_once ('../inc/config.php');
require_once ('../language/'.$row['language'].'.php');

$_GET = security::escape($_GET);
$_POST = security::escape($_POST);
$EoT = new eGamersofTomorrow;

$weaponsU = array("arAK74","arM416","arAEK","arM16","arAN94","arF2","arG3","arKH","srM40","srM98","srMK11","srSKS","srSV98","srSVD",
 "mgM240","mgM249","mgM27","mgM60","mgPech","mgRPK","mgT88","caA91","caAKS","caG36","caM4","caSCAR","caSG553","sg870","sgDAO","sgM1014","sgSaiga",
 "sgUSAS","smMP7","smP90","smPDR","smPP2000","smUMP","smVAL","arFAMAS","arL85A2","caHK53","caQBZ95B","mgQBB95","mgMG36","srQBU88","srL96","smPP19","sgJackH","wahUGL","srM39","arAUG","arSCARL","mgL86A1","mgLSAT","caACR","caMTAR21","srHK417","srJNG90","sgSPAS12","smM5K");

if(isset($_GET['wUnlocks']) && !empty($_GET['wUnlocks']) && $_GET['wUnlocks'] != '' && isset($_GET['name']) && !empty($_GET['name']) && $_GET['name'] != '') {
     if (in_array($_GET['wUnlocks'],$weaponsU)){
       $wUnlock = $_GET['wUnlocks']; 
       $name = $_GET['name'];
     }else{
     	$wUnlock = "arF2"; 
      $name = $_GET['name'];
     }
   }else{
     $wUnlock = "arF2";
     $name = "";
 }

	
	   $sWhere = "a.soldiername = '{$name}'";	   
	$sSql = "
		SELECT 
			a.*,
			b.*
		FROM 
			  ".DBPrefix."generalStats a
		Left JOIN 
         ".DBPrefix."weapons b ON a.pid = b.stats_pid
	  WHERE 
			{$sWhere}";
	
		$rResult = mysql_query($sSql) or $sError = 'Error in Query: ' . mysql_error() . ' in SQL: ' . print_r($sSql, true);


			    $data= mysql_fetch_assoc($rResult);
			    $entrys = mysql_num_rows($rResult);
			    if ($entrys == 0){
		echo 'No Data';
		exit;
	}	
    include('unlocksArray.php');	                 
	  ?>
			<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="de">
				<?php echo $styleSettings; ?>
				<title>Weapon Unlocks <?php echo constant('LANG_WEAPONS_'.$wUnlock).LANG_WEAPONS_UNLOCKS; ?></title> 
				<br />
				 <table  class="defaultUpdate" style="margin-top:-11px;border-radius: 0 0 5px 5px;-webkit-border-radius:0px 0px 5px 5px; border-radius:0px 0px 5px 5px;" cellspacing="0" cellpadding="0">
				  <td class="head" colspan="10" height="20px"><?php echo constant('LANG_WEAPONS_'.$wUnlock).LANG_WEAPONS_UNLOCKS; ?></td>
				  <tr>
				  	<?php 
				  	$i = 0;
				  	$ii = 0;
				  	foreach ($unlocks as $key => $u){
				  		if ($data[$wUnlock.'_kills'] >= $u){
				  			$curr = '<font class="positiv">'.$u.'/'.$u.' Kills</font>';
				  		}else{
				  			$curr = '<font class="negativ">'.$data[$wUnlock.'_kills'].'/'.$u.' Kills</font>';
				  		}
				  		?>
				   <td><b><?php echo constant('LANG_WEAPONS_UNLOCKS_'.$key); ?></b><br /><img src="<?php echo $domain; ?>/img/weapons/weaponunlocks/<?php echo $key; ?>.png" /><br /><?php echo $curr; ?></td>
				   
				 <?php 
				 if (++$i == 6) echo '<tr /><td class="result" colspan="10" height="10px"></td><tr />';
				 if (++$ii == 12) echo '<tr /><td class="result" colspan="10" height="10px"></td><tr />';
				 } 
				 ?>				 
		</table>
	                     
         
   