Advertisement
Guest User

Untitled

a guest
Jul 13th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <?php
  2. require_once('recaptchalib.php');
  3. require('funciones.php');
  4. $conexion = conectarBD();
  5. $privkey = "6LdvPiITAAAAAOkQ6LpzWmpQW3kcNtmMQO64Vqm9";
  6. $verify = recaptcha_check_answer($privkey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
  7.  
  8.  
  9. require 'phpmailer/PHPMailerAutoload.php';
  10. $mail = new PHPMailer;
  11. $mail->isSMTP();
  12. $mail->Host = 'smtp.live.com';
  13. $mail->SMTPAuth = true;
  14. $mail->Username = 'mimail;
  15. $mail->Password = 'mipass';
  16. $mail->SMTPSecure = 'tls';
  17. $mail->Port = 587;
  18. $mail->setFrom($_POST['email']);
  19. $mail->addAddress('prowebutn@hotmail.com');
  20.  
  21.  
  22. $mail->isHTML(false);
  23.  
  24. $mail->Subject = $_POST['asunto'];
  25. $mail->Body = "De: " .$_POST['nombre'] ."\n" ."\n" .$_POST['mensaje'];
  26. if(!$mail->send()) {
  27. echo 'Message could not be sent.';
  28. echo 'Mailer Error: ' . $mail->ErrorInfo;
  29. } else {
  30. echo 'Message sent';
  31. }
  32.  
  33. if ($verify->is_valid) {
  34. header("refresh:3;url=contacto.php");
  35. echo "Mensaje enviado" .$mail->ErrorInfo;;
  36. $nombre = $_POST['nombre'];
  37. $email = $_POST['email'];
  38. $msj = $_POST['mensaje'];
  39. $sql_insert = "insert into mensajes (email, msj, nombre) values ('$email', '$msj', '$nombre')";
  40. mysqli_query($conexion, $sql_insert);
  41.  
  42.  
  43. die();
  44.  
  45. }else {
  46. header("refresh:3;url=contacto.php");
  47. echo "Oops parece que el codigo de verificacion no es correcto. Volviendo a la página anterior.";
  48. }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement