<?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BF3 Leaderboard                                         # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernet werden                     # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BF3 Leaderboard is a free Software--------------# ||
|| #                   http://eot-clan.net                            # ||
|| #################################################################### ||
\*======================================================================*/

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

$_GET = security::escape($_GET);
$_POST = security::escape($_POST);

session_start();
if(isset($_SESSION["username"]))
   {
   	
$pid = $_POST["deleteplayers"];

function deleteFilesFromDirectory($ordnername){
  if (is_dir($ordnername)) {
 if ($dh = opendir($ordnername)) {
    while (($file = readdir($dh)) !== false) {
    	if ($file!="." AND $file !="..") {
  unlink("".$ordnername."".$file."");
  }
 }
closedir($dh);
   }
 }
}

deleteFilesFromDirectory("../logs/$pid/");
$dir = $pid;
if ($directory = @opendir("../logs/".$dir))  {
	rmdir("../logs/$pid/");
  $logs = LANG_ADMIN_LOGS_DELETE;
}else{
	$logs = LANG_ADMIN_LOGS_DELETE_ERROR;
}


mysql_query ("DELETE a.*,b.*,c.*,d.*,e.*,f.*,g.*,h.*,l.*,m.*,n.*,o.*,p.*,r.* FROM 
                ".DBPrefix."generalStats a
            Left JOIN 
               ".DBPrefix."weapons b ON a.pid = b.stats_pid
            Left JOIN 
               ".DBPrefix."vehicles c  ON a.pid = c.stats_pid
            Left JOIN 
               ".DBPrefix."ribbons d  ON a.pid = d.stats_pid
            Left JOIN 
               ".DBPrefix."team e  ON a.pid = e.stats_pid
            Left JOIN 
               ".DBPrefix."coop f  ON a.pid = f.stats_pid
            Left JOIN 
               ".DBPrefix."gamemodes g  ON a.pid = g.stats_pid
            Left JOIN 
               ".DBPrefix."medals h  ON a.pid = h.stats_pid
            Left JOIN 
               ".DBPrefix."stars l  ON a.pid = l.stats_pid
            Left JOIN 
               ".DBPrefix."equipment m  ON a.pid = m.stats_pid
            Left JOIN 
               ".DBPrefix."assignments n  ON a.pid = n.stats_pid
            Left JOIN 
               ".DBPrefix."ServerHistory o  ON a.pid = o.stats_pid
            Left JOIN 
               ".DBPrefix."battlereports p  ON a.pid = p.stats_pid
            Left JOIN 
               ".DBPrefix."battlereportsDetails r  ON a.pid = r.stats_pid
        WHERE 
          pid='$pid'")

 
or die ("Ungültige Abfrage: " . mysql_error());

echo '
<html>
	<head>
		<title>'.LANG_ADMIN_TITLE.'</title>
		'.$styleSettings.'
</head>
 <div class="body_bfLB" style="width:500px; margin-left: -250px;margin-top: -100px;position: absolute;left: 50%;top: 50%;">
 <td class="default" style="font-size:11px;">'.LANG_ADMIN_REMOVE_TEXT.'<br />'.$logs.'</td>
		</div>		
  </table>
</html>';

}
else
{
	?>
	<title>BF3 Admin-Session Error</title>
	<?php echo $styleSettings; ?>
 <div class="body_bfLB" style="width:500px; margin-left: -250px;margin-top: -100px;position: absolute;left: 50%;top: 50%;"><td>
<?php echo LANG_LOGIN_SESSION_ERROR; ?>
   </td></table></div>
     <?php
   }

