 <?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BF3 Leaderboard                                         # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernt werden                      # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BF3 Leaderboard is a free Software--------------# ||
|| #                      http://eot-clan.net                         # ||
|| #################################################################### ||
\*======================================================================*/
 $qry = "SELECT playerupdate FROM ".DBPrefix."generalStats ORDER by playerupdate DESC LIMIT 1 ";
 $result = mysql_query($qry);
 $data = mysql_fetch_assoc($result);
 $uTime = $data['playerupdate'];
 
?>

    <table class="default" style="width:<?php echo $style['IndexTableWidth']; ?>px;">
		<tr>
			<td class="object" colspan="5"><?php echo LANG_INDEX_ALL_LAST_UPDATE_API.' ('.$EoT->unix_to_time($uTime).')' ; ?></td>
			<tr> 
					<?php
				    $qry = "SELECT soldiername,playerupdate,status FROM ".DBPrefix."generalStats ORDER by playerupdate DESC LIMIT 5 ";
            $result = mysql_query($qry);
            while(($data = mysql_fetch_assoc($result)) !== FALSE ) {
            	if ($data['status'] == 1){
            		$status = "up";
            	}else{
            		$status = "gleich";
            	}
			    	echo '<td height="20px"><a href="stats.php?name='.rawurlencode($data['soldiername']).'" target="_self">'.htmlspecialchars($data['soldiername']).'&nbsp;<img src="img/rank/'.$status.'.png" width="19px" style=position:absolute;margin-top:-3px;"/></a></td>';
			     }
			    ?>
	    	<tr>
	    	<td class="object" colspan="5"><?php echo LANG_INDEX_ALL_NEXT_UPDATE_API.' (~'.$EoT->unix_to_time($uTime+900).')' ; ?></td>
			<tr>
			<?php
			      $inativ = $row['inaktivTime']*86400;
			      $qTime = time();
				    $qry = "SELECT soldiername,playerupdate,date_update_bf3s FROM ".DBPrefix."generalStats WHERE playerupdate > 0 AND invisible = '' AND date_update_bf3s+$inativ > $qTime ORDER by playerupdate ASC LIMIT 5 ";
            $result = mysql_query($qry);
            while(($data = mysql_fetch_assoc($result)) !== FALSE ) {
			    	echo '<td height="20px"><a href="stats.php?name='.rawurlencode($data['soldiername']).'" target="_self">'.htmlspecialchars($data['soldiername']).'</a></td>';
			    }
			    ?>
		</tr>
	</table>