Advertisement
agenciamocho

Formulario de Orcamento - Logotipo

Feb 6th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.  
  5. <title>Agência Mocho</title>
  6.  
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <link rel="shortcut icon" href="../images/favicon.gif" />
  9.  
  10. <style type="text/css">
  11. a:link {
  12. text-decoration: none;
  13. color: #f24f13;
  14. }
  15. a:visited {
  16. text-decoration: none;
  17. color: #f24f13;
  18. }
  19. a:hover {
  20. text-decoration: underline;
  21. color: #f24f13;
  22. }
  23. a:active {
  24. text-decoration: none;
  25. color: #f24f13;
  26. }
  27. body {
  28. background-color: #333333;
  29. font-family:Arial, Helvetica, sans-serif;
  30. color:#c0c0c0;
  31. }
  32. body,td,th {
  33. color: #c0c0c0;
  34. }
  35. a {
  36. font-size: 12px;
  37. }
  38. </style>
  39.  
  40. <!--Google Analytics-->
  41. <script type="text/javascript">
  42. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  43. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  44. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  45. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  46. ga('create', 'UA-48343930-1', 'agenciamocho.com');
  47. ga('send', 'pageview');
  48. </script>
  49.  
  50. </head>
  51. <body>
  52. <br /><br /><br />
  53.  
  54. <table align="center" width="100%" border="0">
  55. <tr><td align="center">
  56.  
  57. <br />
  58. <img src="../images/agencia-mocho-envio.png" alt="" height="115" width="240" align="middle" />
  59. <br /><br />
  60.  
  61.  
  62.  
  63. <?php
  64.  
  65. /*apenas dispara o envio da mensagem caso houver/existir $_POST['enviar']*/
  66.  
  67. if (isset($_POST['enviar']))
  68. {
  69.  
  70. $destinatarios = 'nome@email.com';
  71. $nomeDestinatario = 'Agencia Mocho';
  72. $usuario = 'nome@email.com';
  73. $senha = 'XXXXXX';
  74.  
  75.  
  76. /*abaixo as veriaveis principais, que devem conter em seu formulario*/
  77. $categoria = $_POST["categoria"];
  78. $nome = $_POST["nome"];
  79. $email = $_POST["email"];
  80. $cidade = $_POST["cidade"];
  81. $website = $_POST["website"];
  82. $empresa = $_POST["empresa"];
  83. $areaatuacao = $_POST["areaatuacao"];
  84. $tipodenegocio = $_POST["tipodenegocio"];
  85. $caracterconteudo = $_POST["caracterconteudo"];
  86. $incluir_objeto_na_marca = $_POST["incluir_objeto_na_marca"];
  87. $preferencia_cores = $_POST["preferencia_cores"];
  88. $referencia = $_POST["referencia"];
  89. $comentarios = $_POST["comentarios"];
  90.  
  91. //Loop para o Checkbox $caracterconteudo
  92. if (isset($_POST["enviar"])){
  93. foreach($_POST["caracterconteudo"] as $caracterconteudo)
  94. {$caracterconteudo_check = "$caracterconteudo_check "."$caracterconteudo".",";
  95. }}
  96.  
  97. //Dados que vão aparecer no corpo do e-mail
  98. $_POST['mensagem'] = nl2br('
  99.  
  100. <b>Nome:</b> '. $_POST['nome'] ."
  101.  
  102. <b>E-mail:</b> ". $_POST['email'] ."
  103.  
  104. <b>Cidade:</b> ". $_POST['cidade'] ."
  105.  
  106. <b>Website:</b> ". $_POST['website'] ."
  107.  
  108. <b>Nome que aparecerá no Logotipo:</b> ". $_POST['empresa'] ."
  109.  
  110. <b>Descreva a sua área de atuação:</b> ". $_POST['areaatuacao'] ."
  111.  
  112. <b>O seu negócio é um(a):</b> ". $_POST['tipodenegocio'] ."
  113.  
  114. <b>Quais características descrevem melhor o seu negócio?</b> $caracterconteudo_check"."
  115.  
  116. <b>O que não pode faltar na sua marca?</b> ". $_POST['incluir_objeto_na_marca'] ."
  117.  
  118. <b>Cores de sua preferência:</b> ". $_POST['preferencia_cores'] ."
  119.  
  120. <b>Possui referência de outra marca?:</b> ". $_POST['referencia'] ."
  121.  
  122. <b>Comentarios Finais:</b> ". $_POST['comentarios']);
  123.  
  124.  
  125.  
  126.  
  127. //mensagens de erro para caso algum campo fique em branco
  128.  
  129. if ($nome == "") {
  130. echo "<p align=center>Por favor, preencha o campo nome.</p>";
  131. }
  132. else if ($email == "") {
  133. echo "<p align=center>Por favor, preencha o campo email.</p>";
  134. }
  135. else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  136. echo "<p align=center>Informe um e-mail válido.</p>";
  137. }
  138. else if ($empresa == "") {
  139. echo "<p align=center>Por favor, preencha o campo empresa.</p>";
  140. }
  141. else {
  142.  
  143.  
  144.  
  145.  
  146. /*********************************** A PARTIR DAQUI NAO ALTERAR ************************************/
  147.  
  148. include_once("../phpmailer/class.phpmailer.php");
  149.  
  150. $To = $destinatarios;
  151. $Subject = 'Orcamento - Logotipo';
  152. $Message = $_POST['mensagem'];
  153.  
  154. $Host = 'smtp.'.substr(strstr($usuario, '@'), 1);
  155. $Username = $usuario;
  156. $Password = $senha;
  157. $Port = "587";
  158.  
  159. $mail = new PHPMailer();
  160. $mail->IsSMTP(); // telling the class to use SMTP
  161. $mail->Host = $Host; // SMTP server
  162. $mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
  163. // 1 = errors and messages
  164. // 2 = messages only
  165. $mail->SMTPAuth = true; // enable SMTP authentication
  166. $mail->Port = $Port; // set the SMTP port for the service server
  167. $mail->Username = $Username; // account username
  168. $mail->Password = $Password; // account password
  169.  
  170. $mail->SetFrom($usuario, $nomeDestinatario);
  171. $mail->Subject = $Subject;
  172. $mail->MsgHTML($Message);
  173. $mail->AddAddress($To, "");
  174.  
  175.  
  176.  
  177. // CÓDIGO DO ANEXO - SIMPLES!
  178.  
  179. $files = $_FILES['files'];
  180. for ($i=0; $i < sizeof($files); $i++)
  181. {
  182. if (is_uploaded_file($files['tmp_name'][$i]))
  183. {
  184. // Adiciona um anexo de um caminho sobre o sistema de ficheiros
  185. $mail->AddAttachment($files['tmp_name'][$i], $files['name'][$i]);
  186. }
  187. }
  188.  
  189.  
  190. // FIM DO CÓDIGO DO ANEXO
  191.  
  192.  
  193.  
  194. if(!$mail->Send()) {
  195. $mensagemRetorno = 'Erro ao enviar e-mail: '. print($mail->ErrorInfo);
  196. $mail->ErrorInfo."\n";
  197. } else {
  198. echo "<p align=center>$nome, sua mensagem foi enviada.</p>";
  199. echo "<p align=center>Retornaremos em breve.</p>";
  200. }
  201. }
  202. }
  203. ?>
  204.  
  205.  
  206.  
  207. <br /><br />
  208. <a href="../orcamento-logotipo.html"> retornar </a>
  209.  
  210. </td></tr></table>
  211. </body>
  212. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement