Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. <!-- contacto-->
  2.  
  3. <section class="contact" id="contact">
  4.  
  5. <h1>Contacto</h1>
  6. <hr/>
  7.  
  8. <div class="content">
  9.  
  10. <div class="form">
  11.  
  12. <form method="post" action="mail.php" name="contact">
  13.  
  14. <div class="column">NOMBRE<br/><br/>
  15. <input name="name" id="name" value="" />
  16. </div>
  17.  
  18. <div class="column-2">E-MAIL<br/><br/>
  19. <input name="email" id="email" value="" />
  20. </div>
  21.  
  22.  
  23. <div class="column-3">MENSAJE<br/><br/>
  24. <textarea id="message" name="message" ></textarea>
  25. </div>
  26.  
  27. <div class="button">
  28. <span><input class="submit" id="submit" name="submit" type="submit" value="ENVIAR"></span>
  29. </div>
  30.  
  31. <div id="dialog-message" title="Thank You">
  32. <p>¡Gracias! Tu mensaje ha sido enviado, te responderemos lo antes posible.</p>
  33. </div>
  34.  
  35. </form>
  36.  
  37. </div>
  38.  
  39.  
  40. <div class="contact-text">
  41.  
  42. No dudes en solicitarnos información.<br/><br/>
  43.  
  44.  
  45. <strong>RAM Producciones</strong><br/><br/>
  46.  
  47. e-mail: <strong>info@ramproducciones.com</strong>
  48.  
  49. <br/><br/>
  50.  
  51. <a href="https://facebook.com/RAMproduccionesSAC" target="_blank"><img src=img/social/Facebook.png /></a>
  52. <a href="https://vimeo.com/ramproduccionessac" target="_blank"><img src=img/social/Vimeo.png /></a>
  53. <a href="https://www.behance.net/RAMProduccionesSAC" target="_blank"><img src=img/social/Behance.png /></a>
  54. <a href="https://www.instagram.com/ram.producciones" target="_blank"><img src=img/social/Instagram.png /></a>
  55. <a href="https://www.youtube.com/channel/UCIF9shcqE4D5cF5Xp7LBasg" target="_blank"><img src=img/social/Youtube.png /></a>
  56.  
  57. </div>
  58.  
  59. </div>
  60.  
  61. </section>
  62.  
  63. <?php
  64.  
  65. // define variables and set to empty values
  66. $name_error = $email_error = "";
  67. $name = $email = $message = $success = "";
  68.  
  69. //form is submitted with POST method
  70. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  71. if (empty($_POST["name"])) {
  72. $name_error = "Name is required";
  73. } else {
  74. $name = test_input($_POST["name"]);
  75. // check if name only contains letters and whitespace
  76. if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
  77. $name_error = "Solo ingresa letras y espacios.";
  78. }
  79. }
  80.  
  81. if (empty($_POST["email"])) {
  82. $email_error = "Tu E-mail es necesario";
  83. } else {
  84. $email = test_input($_POST["email"]);
  85. // check if e-mail address is well-formed
  86. if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  87. $email_error = "Formato de E-mail inválido";
  88. }
  89. }
  90.  
  91. if (empty($_POST["message"])) {
  92. $message = "";
  93. } else {
  94. $message = test_input($_POST["message"]);
  95. }
  96.  
  97. if ($name_error == '' and $email_error == '' and $phone_error == '' and $url_error == '' ){
  98. $message_body = '';
  99. unset($_POST['submit']);
  100. foreach ($_POST as $key => $value){
  101. $message_body .= "$key: $valuen";
  102. }
  103.  
  104. $to = 'info@ramproducciones.pe';
  105. $subject = 'Mail vía RAMPRODUCCIONES.PE';
  106. if (mail($to, $subject, $message)){
  107. $success = "¡Gracias! Tu mensaje ha sido enviado, te responderemos lo antes posible.";
  108. $name = $email = $message = '';
  109. }
  110. }
  111.  
  112. }
  113.  
  114. function test_input($data) {
  115. $data = trim($data);
  116. $data = stripslashes($data);
  117. $data = htmlspecialchars($data);
  118. return $data;
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement