Advertisement
Guest User

Untitled

a guest
May 19th, 2017
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <?php
  2. $nome = strip_tags(trim($_POST['nome']));
  3. $email = strip_tags(trim($_POST['email']));
  4. $cidade = strip_tags(trim($_POST['cidade']));
  5. $pagamento = strip_tags(trim($_POST['pagamento']));
  6. $valor = strip_tags(trim($_POST['valor']));
  7. $arquivo = $_FILES['arquivo'];
  8.  
  9. $tamanho = 1048576;
  10. $tipos = array('image/jpeg', 'image/pjpeg');
  11.  
  12. if(empty($nome)){
  13. $msg = 'O Nome é Obrigatório';
  14. }elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
  15. $msg = 'Digite um E-mail válido';
  16. }elseif(empty($cidade)){
  17. $msg = 'O Campo Cidade é Obrigatório';
  18. }elseif(empty($pagamento)){
  19. $msg = 'O Campo Pagamento é Obrigatório';
  20. }elseif(empty($valor)){
  21. $msg = 'O Campo Valor é Obrigatório';
  22. }elseif(!is_uploaded_file($arquivo['tmp_name'])){
  23. $msg = 'O Comprovante é Obrigatório';
  24. }elseif($arquivo['size'] > $tamanho){
  25. $msg = 'O limite do tamanho do arquivo é de 1MB';
  26. }elseif(!in_array($arquivo['type'], $tipos)){
  27. $msg = 'O tipo do arquivo permitido é apenas JPEG';
  28. }else{
  29. require('PHPMailer/class.phpmailer.php');
  30.  
  31. $mail = new PHPMailer();
  32. $mail->IsSMTP();
  33. $mail->SMTPAuth = true;
  34. $mail->Port = 587;
  35. $mail->Host = 'smtp.lirhbol.com.br';
  36. $mail->Username = 'l101113';
  37. $mail->Password = 'ltn2bzE7';
  38. $mail->SetFrom('ligadehandebol@lirhbol.com.br', 'Lucas');
  39. $mail->AddAddress('lukoviz@hotmail.com', 'Claudio');
  40. $mail->Subject = 'Inscrição no Curso';
  41.  
  42. $body = "<strong>Nome :</strong>{$nome} <br />
  43. <strong>E-mail :</strong>{$email} <br />
  44. <strong>Titulo :</strong>{$titulo} <br />
  45. <strong>Mensagem :</strong>{$mensagem} <br />
  46. <strong>Arquivo :</strong> ".$arquivo['name'];
  47.  
  48. $mail->MsgHTML($body);
  49. $mail->AddAttachment($arquivo['tmp_name'], $arquivo['name']);
  50.  
  51. if($mail->Send())
  52. $msg = 'Sua Mensagem foi enviada com Sucesso!!!';
  53. else
  54. $msg = 'Sua Mensagem n�o foi enviada, tente novamente';
  55.  
  56. }
  57.  
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement