
    <h2>Selecione os arquivos:</h2>
    <form method="post" name="multiple_upload_form" id="multiple_upload_form" enctype="multipart/form-data" action="upload.php" target="iframe" class="form-inline">
        <input type="hidden" name="image_form_submit" value="1"/>
        <label>Escolha os Arquivos
        <input type="file" name="images[]" id="images" multiple class="form-control"></label>
        <button type="button" id="btn" class="btn btn-success">
            <i class="glyphicon glyphicon-floppy-save"></i>
            Enviar Arquivos
        </button>
    </form>
    <br><br>
    <div class="uploading none" style="display: none">
        <label>Aguarde... enviando arquivos...</label>
        <img src="images/load.gif" alt="uploading......">
    </div>
    <div id="images_preview" class="thumbnail"></div>


</div>
<script type="text/javascript">
$(document).ready(function(){
    $('#btn').on('click',function(){
        $('#multiple_upload_form').ajaxForm({
            //display the uploaded images
            target:'#images_preview',
            beforeSubmit:function(e){
                $('.uploading').show();
            },
            success:function(e){
                $('.uploading').hide();
            },
            error:function(e){
            }
        }).submit();
    });
});
</script>



        //$zip = new ZipArchive;
            
            /*if ( $zip->open( realpath ( $arq ) ) ) {

                if( $zip->extractTo( realpath ( $dir ) ) {

                } else {
                    echo "<script>alert('Erro ao descompactar arquivo');</script>";
                }

            } else {

                echo "<script>alert('Erro ao encontrar aquivo');</script>";

            }*/



    DIONISIO VERDEIRO
    EDILSON OPTSKI
    RAFAEL DE LEMOS
    VALERIA PEREIRA



     require 'PHPMailerAutoload.php';
    

    $sql = "select a.*, e.id eid, c.nome cliente, c.email 
        from arquivo a
        left join envio e on (a.id = e.arquivo_id) 
        inner join cliente c on (c.id = a.cliente_id)
        limit 1";
    $consulta = $db->prepare($sql);
    $consulta->execute();
    while ( $dados = $consulta->fetch( PDO::FETCH_OBJ ) ) {

        $email = "burnes@professorburnes.com";

        if ( empty ( $dados->eid ) ) {

            //Create a new PHPMailer instance
            $mail = new PHPMailer;
            //Tell PHPMailer to use SMTP
            $mail->isSMTP();
            //Enable SMTP debugging
            // 0 = off (for production use)
            // 1 = client messages
            // 2 = client and server messages
            $mail->SMTPDebug = 0;
            //Ask for HTML-friendly debug output
            $mail->Debugoutput = 'html';
            //Set the hostname of the mail server
            $mail->Host = 'mail.maxcredit.com.br';
            // use
            // $mail->Host = gethostbyname('smtp.gmail.com');
            // if your network does not support SMTP over IPv6
            //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
            $mail->Port = 25;
            //Set the encryption system to use - ssl (deprecated) or tls
            //$mail->SMTPSecure = 'ssl';
            //Whether to use SMTP authentication
            $mail->SMTPAuth = true;
            //Username to use for SMTP authentication - use full email address for gmail
            $mail->Username = "naoresponda@maxcredit.com.br";
            //Password to use for SMTP authentication
            $mail->Password = "maxserasa!%1";
            //Set who the message is to be sent from
            $mail->setFrom('naoresponda@maxcredit.com.br', 'MaxCredit');
            $mail->addAddress("financeiro01@maxcredit.com.br", "Thiago Alano");
            $mail->addAddress("burnes@professorburnes.com", "Burnes");
            //Set the subject line
            $mail->Subject = 'Teste de envio de e-mail - '. time();
            //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
            $mail->msgHTML("<p class='font:14px Verdana'>Prezado Cliente,<br>Segue boleto em anexo referente consultas SPC Brasil.<br>
    Caso haja o pagamento em atraso, atualizar o boleto pelo site https://www.itau.com.br/servicos/boletos/ .
    <br>Após o vencimento, caso o boleto não esteja pago, haverá a suspensão dos serviços.<br><br> 
    Atenciosamente</p>");
            //Replace the plain text body with one created manually
            $mail->AltBody = 'This is a plain-text message body';
            //Attach an image file
            $mail->addAttachment('../../downloads/'.$dados->arquivo);

            //send the message, check for errors
            if (!$mail->send()) {
                echo "<p class='alert alert-danger'>Erro ao enviar e-mail $email : " . $mail->ErrorInfo."</p>";
            } else {
                echo "<p class='alert alert-success'>Mensagem enviada com sucesso para $email!</p>";
            }
        }

        exit;
    }
?>
