Guest User

Untitled

a guest
Jan 23rd, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include 'conexion.php';
  4.  
  5. if(isset($_POST) && !empty($_POST)){
  6.  
  7. if(!empty($_FILES['archivo']['name'])){
  8. $names = $_SESSION['usuario']['nombres'];
  9. $ape = $_SESSION['usuario']['apellidos'];
  10. $dni = $_SESSION['usuario']['dni'];
  11. $tlf1 = $_SESSION['usuario']['fijo'];
  12. $tlf2 = $_SESSION['usuario']['mov'];
  13. $email = $_SESSION['usuario']['email'];
  14. $d_entrega = $_SESSION['usuario']['direccion_entrega'];
  15. $d_facturacion = $_SESSION['usuario']['direccion_facturacion'];
  16. $cod = $_POST['cod'];
  17. $file_name = $_FILES['archivo']['name'];
  18. $temp_name = $_FILES['archivo']['tmp_name'];
  19. $file_type = $_FILES['archivo']['type'];
  20.  
  21. $base = basename($file_name);
  22. $extension = substr($base, strlen($base)-4, strlen($base));
  23.  
  24. $extensiones = array(".doc",".docx",".pdf",".png",".jpg",".jpeg");
  25.  
  26. if(in_array($extension,$extensiones)){
  27. $from = $_POST['email'];
  28. $to = "hmla9612@gmail.com";
  29. $asunto = "CONFIRMACIÓN DE PAGO DE PEDIDO";
  30.  
  31. $mensaje = '
  32. <html>
  33. <body>
  34. <p><img src="http://mvmultiservicios.es/banners/multi_mv_.jpg" width="669" height="348" /><br />
  35. <br />
  36. </p>
  37. <h2 class="tre2">DATOS DE LA PERSONA QUIEN CONFIRMO SU DEPOSITO O TRANSFERENCIA<br />
  38. </h2>
  39. <h4>Nombres: '.$names.' '.$ape.'</h4>
  40. <h4>DNI: '.$dni.'</h4> <br />
  41. <h4>Telefono Fijo: '.$tlf1.'</h4>
  42. <h4>Telefono Movil: '.$tlf2.'</h4>
  43. <h4>Email: '.$email.'</h4>
  44. <h4>Dirección de entrega: '.$d_entrega.'</h4>
  45. <h4>Dirección de Facturación: '.$d_facturacion.'</h4>
  46. <br><br>
  47. <h4>'.$cod.'</h4>
  48. <img src="http://mvmultiservicios.es/images/abajoemail.jpg" width="669" border="0" usemap="#Map" />
  49. <map name="Map" id="Map">
  50. <area shape="rect" coords="37,227,113,250" href="http://mvmultiservicios.es/contacto.php" target="_blank" />
  51. <area shape="rect" coords="12,5,656,40" href="http://mvmultiservicios.es/reporte.php" target="_blank" />
  52. </map>
  53. <br />
  54. <span class="trebww"> Multiservicios Melga-Villafuerte SL.<br />
  55. Dirección: C/Padilla 334-336, Local 1, C.P. 08025 Barcelona<br />
  56. +34931 75 69 73 +34 601 020 475<br />
  57. info@mvmultiservicios.es | comercial@mvmultiservicios.es</span></h3>
  58. <h2 class="tre2">&nbsp; </h2>
  59. <h2 class="treb">&nbsp; </h2>
  60. <p> <br />
  61. <br />
  62. </p>
  63. </body>
  64. </html>
  65. ';
  66.  
  67. $file = $temp_name;
  68. $content = chunk_split(base64_encode(file_get_contents($file)));
  69. $uid = md5(uniqid(time()));
  70.  
  71. $header = "From: ".$from."rn";
  72. $header .= 'MIME-Version: 1.0' . "rn";
  73.  
  74. $header .= "Content-Type: multipart/mixed; boundary="".$uid.""rnrn";
  75. $header .= "--" .$uid. "rn";
  76. $header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  77. $header .= "Content-Transfer-Encoding: 7bitrnrn";
  78.  
  79. $header .= "--".$ui."rn";
  80. $header .= "Content-Type: ".$file_type."; name="".$file_name.""rn";
  81. $header .= "Content-Transfer-Encoding: base64rn";
  82. $header .= "Content-Disposition: attachment; filename="".$file_name.""rnrn";
  83. $header .= $content."rnrn";
  84.  
  85. if(mail($to, $asunto, $mensaje, $header)){
  86. echo "success";
  87. }else{
  88. echo "fallo el envio";
  89. }
  90.  
  91. }else{
  92. echo "El formato del archivo no es admitido";
  93. }
  94. }else{
  95. echo "No hay archivo adjuntado";
  96. }
  97. }
  98. ?>
Add Comment
Please, Sign In to add comment