<?php

    
foreach($ServerData as $Key)
    {

        
$FTP ftp_connect($Key['host']);
    
        
ftp_login($FTP$Key['user'], $Key['pass']);
    
        
$Data ftp_nlist($FTP'/csgo/*.dem');
        
        
$Count count($Data);
        
        if(
$Count != 1)
        {
    
            foreach(
$Data as $KeyTwo => $Value)
            {
                
                
$Count -= 1;
                
                if(
$Count != 1)
                {
        
                    
$Name str_replace('/csgo/'''$Value);
        
                    
$File fopen('./cache/'.$Key['prefix'].'_'.$Name.'',"w");
        
                    
$Get ftp_fget($FTP$File$ValueFTP_BINARY);
        
                    
fwrite($File$Get); 
            
                    
fclose($File); 
            
                    
ftp_delete($FTP$Value);
            
                    
$NameTwo str_replace('.dem'''$Name);
            
                    
$ZIP = new ZipArchive();
            
                    
$ZIP->open('./files/'.$Key['prefix'].'_'.$NameTwo.'.zip'ZIPARCHIVE::CREATE);
                    
$ZIP->addFile('./cache/'.$Key['prefix'].'_'.$Name.'');
                    
$ZIP->close();
            
                    
unlink('./cache/'.$Key['prefix'].'_'.$Name.'');
                    
                }
        
            }
            
        }
        
        
ftp_close($FTP);
        
        unset(
$FTP);
        unset(
$Data);
        unset(
$Name);
        unset(
$File);
        unset(
$Get);
        unset(
$NameTwo);
        unset(
$ZIP);
        
    }
    


?>