"; $basename = basename($_SERVER['PHP_SELF']);//echo $basename."
"; } $dir = dirname(__FILE__).DIRECTORY_SEPARATOR; $tmp_dir = "$dir"."tmp_dir".DIRECTORY_SEPARATOR; $img_dir = "$dir"."tmp_dir".DIRECTORY_SEPARATOR; define('PATH_IMG', "$dir"."tmp_dir".DIRECTORY_SEPARATOR); if ($action == "delete"){ $dirfile = $dir."tmp_dir".DIRECTORY_SEPARATOR.$filetodelete; if(file_exists($dirfile)){ $output = unlink($dirfile); // Excluir o arquivo if($output){ $message = "
Arquivo excluido: ".$filetodelete.".
"; } else { $message = "
Não foi possível apagar o arquivo: $filetodelete
"; } } else { $message = "
Arquivo não encontrado!
"; } function extractt($var) { global $filetodelete; if($filetodelete != $var) { return 1; } } $array_files = $_SESSION['array_file']; //echo sizeof($array_files)."
"; $array_files = array_filter($array_files, "extractt"); reset($array_files); //echo sizeof($array_files)."
"; //print_r($array_files); reset($array_files); $_SESSION['array_file'] = NULL; unset($_SESSION['array_file']); $_SESSION['array_file'] = $array_files; } //////////////////////////////////// UPLOAD DOS ARQUIVOS ///////////////////////////////////////////// $array_files = array(); if ($anexo == "true") { $file = $_FILES['attachment']['name']; $tmp_file = $_FILES['attachment']['tmp_name']; if(move_uploaded_file($tmp_file,"tmp_dir/$file")) { $array_files = $_SESSION['array_file']; if(sizeof($array_files)==0) { $array_files = array(); } $array_to_add[0] = $file; $array_files = array_merge($array_files,$array_to_add); $_SESSION['array_file'] = $array_files; } } //////////////////////////////////// UPLOAD DOS ARQUIVOS ///////////////////////////////////////////// $counter = 0; #################################################################################################### #################################################################################################### $array_files = $_SESSION['array_file']; // Array com os arquivos uploaded //$array_files = array("preview.swf","preview2.swf"); //$files = array("preview.swf","preview2.swf"); if($enviar == "Enviar") { $email_from = "$Nome <$Email>"; // Who the email is from $email_message = ""; // Message that the email has in it $Body = "Nome: $Nome\n\n"; $Body .= "Email:\n$Email\n\n"; $Body .= "Telefone: \n$Telefone\n\n"; $Body .= "Cidade: \n$Cidade\n\n"; $Body .= "Mensagem: \n$Mensagem\n"; $Body = nl2br($Body); $EmailTo = "contato@pedrobom.adv.br"; // Who the email is too $Subject = "MENSAGEM VIA SITE "; // $headers = "From: $email_from"; $array_files; if(sizeof($array_files)) { $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; $headers = "From: $Email\r\n" . "Reply-To: $Nome <$Email>\r\n". "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $Body . "\n\n"; /********************************************** Anexa Arquivos ********************************************/ for($i=0;$iFile: ".$array_files[$i] ."
"; $filename = $array_files[$i]; $file = fopen($tmp_dir.$array_files[$i],"rb"); $data = fread($file,filesize($tmp_dir.$array_files[$i])); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$filename}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$filename}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } unset($data); unset($file); #unset($fileatt); #unset($fileatt_type); #unset($fileatt_name); /********************************************** Anexa Arquivos ********************************************/ } else { /********************************************* E-mail sem anexos ******************************************/ $headers .= "From: $Email\r\n"; $headers .= "Reply-To: $Nome <$Email>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=iso-utf-8-1\r\n"; //$headers .= "From: $Nome <$Email>\r\n"; $message = $Body; } $ok = mail($EmailTo, $Subject, $message, $headers); if($ok) { // Deleta arquivos uploaded if(sizeof($array_files)) { while (list($key, $value) = each($array_files)) { $dirfile = $dir."tmp_dir".DIRECTORY_SEPARATOR.$value; //echo $dirfile."
"; $output = unlink($dirfile); } } unset($array_files); $_SESSION['array_file'] = NULL; unset($_SESSION['array_file']); $message = "The file was successfully sent!"; } else { $message = "Seu e-mail não pode ser enviado. Por favor tente novamente!
"; } } if($basename == "e-contato.php") { ?> E-mail

Nome / Empresa

 

E-mail

Telefone - DDD

Cidade / Estado

Mensagem

  
 


MENSAGEM ENVIADA COM SUCESSO!
RESPONDEREMOS EM BREVE!!!