E:
/
home
/
kbcomunicacao1
/
Web
/
press-kit
/
in-cosmetics-en
/
adm
/
upload
/
uploads
/
Upload File
HOME
<?php require '../../includes/conexao/funcao.inc.php'; require '../../includes/conexao/config.php'; require '../../includes/conexao/conn.php'; require '../../includes/conexao/function.php'; $arquivo = $_GET["arquivo"];//nome do arquivo real $contato = $_GET["contato"];//nome do destinatario $empresa = $_GET["empresa"];//empresa do destinatario $user = $_GET["user"];//id do usuario que enviou $email = $_GET["email"];//email do destinatario $flw = $_GET["flw"];//id do flw $nomedoarquivo = $_GET["nomedoarquivo"];//nome apelido do arquivo $chave = $_GET['chave']; $data_atual = date("Y-m-d"); $hora = date('H:m:s'); $data_hj = date("d/m/Y"); $queryass = "SELECT assunto_flw, cliente_flw, status_flw FROM cw_flw WHERE id_flw='$flw' LIMIT 1"; $resultass = DBExecute($queryass); $resass = mysqli_fetch_assoc($resultass); $assunto_flw = $resass['assunto_flw']; $cliente_flw = $resass['cliente_flw']; $status_flw = $resass['status_flw']; if($status_flw==0){ $btnstatus = "<span class='label label-primary'>Ativo</span>"; }else{ $btnstatus = "<span class='label label-default'>Encerrado</span>"; } $query = "SELECT razao_cliente FROM cw_cliente WHERE id_cliente='$empresa' "; $result = DBExecute($query); $res = mysqli_fetch_assoc($result); $razao_cliente = $res['razao_cliente']; require '../../includes/conexao/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.grupocaom.com.br'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'sistema@grupocaom.com.br'; // SMTP username $mail->Password = 'grupocaom'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('sistema@grupocaom.com.br', 'Grupo Caom'); $titulo = utf8_decode("ANEXO - Sistema de solicitação - Grupo Caom"); $mensagem = utf8_decode("<!doctype html> <html> <head> <meta charset='utf-8'> </head> <body> <img src='http://www.grupocaom.com.br/sistema/midia/img/topo.jpg' title='Grupo Caom' /> <br /> <div style='width:920px; float:left; margin-left:150px;> <strong style='margin-left:30px; font-variant:small-caps; font-size:20px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;'> </strong> <strong style='margin-left:30px; font-size:24px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;'>ANEXO - SISTEMA DE SOLICITAÇÃO GRUPO CAOM</strong><br /><br /> <strong style='margin-left:30px; font-size:16px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;'>Você abriu o anexo $nomedoarquivo em $data_hj às $hora.</strong><br /><br /> <p style='margin-left:30px; font-size:14px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; text-align:justify'>Atenciosamente,<br /> <em>Grupo Caom</em> </p><br /><br /><br /> <p style='margin-left:30px; font-size:14px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; text-align:justify'>Por favor, não responda esse e-mail.</p> </div> </body> </html> "); $mail->isHTML(true); // Set email format to HTML $mail->Subject = "$titulo"; $mail->Body = "$mensagem"; $mail->addAddress("$email", "$contato"); $mail->send(); $timeline = array( //nome do campo da tabela que vai atualizar => o valor que vai receber 'user_timeline' => "$user", 'data_timeline' => "$data_atual", 'hora_timeline' => "$hora", 'tipo_timeline' => "4", 'titulo_timeline' => "$btnstatus <br /> $contato abriu o arquivo: (<strong>$nomedoarquivo</strong>) em $data_hj às $hora<br /> Cliente: $razao_cliente <br /> Assunto da solicitação: $assunto_flw", 'link_timeline' => "./?pag=flw_detail&id=$flw", 'icon_timeline' => "<i class='fa fa-file-archive-o'></i>" ); $gravatimeline = DBCreate('timeline', $timeline); //CRIAR //nome da variavel pode ser qqr uma $ocorrencia = array( //nome do campo da tabela que vai atualizar => o valor que vai receber 'chave_ocorrencia' => "$chave", 'criacao_ocorrencia' => "$data_atual", 'horac_ocorrencia' => "$hora", 'tipo_ocorrencia' => "0", 'de_ocorrencia' => "$user", 'para_ocorrencia' => "$user", 'destino_ocorrencia' => "$contato", 'descricao_ocorrencia' => "Cliente $contato abriu o anexo (<strong>$nomedoarquivo</strong>)", 'status_ocorrencia' => "1" ); $gravaocorrencia = DBCreate('ocorrencia', $ocorrencia); if(isset($arquivo) && file_exists($arquivo)){ // faz o teste se a variavel não esta vazia e se o arquivo realmente existe switch(strtolower(substr(strrchr(basename($arquivo),"."),1))){ // verifica a extensão do arquivo para pegar o tipo case "txt": $tipo="application/txt"; break; case "pdf": $tipo="application/pdf"; break; case "exe": $tipo="application/octet-stream"; break; case "zip": $tipo="application/zip"; break; case "doc": $tipo="application/msword"; break; case "docx": $tipo="application/msword"; break; case "xls": $tipo="application/vnd.ms-excel"; break; case "xlsx": $tipo="application/vnd.ms-excel"; break; case "ppt": $tipo="application/vnd.ms-powerpoint"; break; case "gif": $tipo="image/gif"; break; case "png": $tipo="image/png"; break; case "jpg": $tipo="image/jpg"; break; case "mp3": $tipo="audio/mpeg"; break; case "php": // deixar vazio por seurança case "htm": // deixar vazio por seurança case "html": // deixar vazio por seurança } header("Content-Type: ".$tipo); // informa o tipo do arquivo ao navegador header("Content-Length: ".filesize($arquivo)); // informa o tamanho do arquivo ao navegador header("Content-Disposition: attachment; filename=".basename($arquivo)); // informa ao navegador que é tipo anexo e faz abrir a janela de download, tambem informa o nome do arquivo readfile($arquivo); // lê o arquivo exit; // aborta pós-ações }else{ ?> <script language="javascript"> alert("<?php $mensagemexc="Não foi possivél efetuar download. Arquivo excluido."; echo utf8_decode($mensagemexc); ?>"); history.go(-1); </script> <?php } ?>