Guest User

Untitled

a guest
Jan 23rd, 2018
264
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. $asunto = "CONFIRMACIÓN DE PAGO DE PEDIDO";
  29.  
  30. $mensaje = '
  31. <html>
  32. <body>
  33. <p><img src="http://mvmultiservicios.es/banners/multi_mv_.jpg" width="669" height="348" /><br />
  34. <br />
  35. </p>
  36. <h2 class="tre2">DATOS DE LA PERSONA QUIEN CONFIRMO SU DEPOSITO O TRANSFERENCIA<br />
  37. </h2>
  38. <h4>Nombres: '.$names.' '.$ape.'</h4>
  39. <h4>DNI: '.$dni.'</h4> <br />
  40. <h4>Telefono Fijo: '.$tlf1.'</h4>
  41. <h4>Telefono Movil: '.$tlf2.'</h4>
  42. <h4>Email: '.$email.'</h4>
  43. <h4>Dirección de entrega: '.$d_entrega.'</h4>
  44. <h4>Dirección de Facturación: '.$d_facturacion.'</h4>
  45. <br><br>
  46. <h4>'.$cod.'</h4>
  47. <img src="http://mvmultiservicios.es/images/abajoemail.jpg" width="669" border="0" usemap="#Map" />
  48. <map name="Map" id="Map">
  49. <area shape="rect" coords="37,227,113,250" href="http://mvmultiservicios.es/contacto.php" target="_blank" />
  50. <area shape="rect" coords="12,5,656,40" href="http://mvmultiservicios.es/reporte.php" target="_blank" />
  51. </map>
  52. <br />
  53. <span class="trebww"> Multiservicios Melga-Villafuerte SL.<br />
  54. Dirección: C/Padilla 334-336, Local 1, C.P. 08025 Barcelona<br />
  55. +34931 75 69 73 +34 601 020 475<br />
  56. <h2 class="tre2">&nbsp; </h2>
  57. <h2 class="treb">&nbsp; </h2>
  58. <p> <br />
  59. <br />
  60. </p>
  61. </body>
  62. </html>
  63. ';
  64.  
  65. $file = $temp_name;
  66. $content = chunk_split(base64_encode(file_get_contents($file)));
  67. $uid = md5(uniqid(time()));
  68.  
  69. $header = "From: ".$from."rn";
  70. $header .= 'MIME-Version: 1.0' . "rn";
  71.  
  72. $header .= "Content-Type: multipart/mixed; boundary="".$uid.""rnrn";
  73. $header .= "--" .$uid. "rn";
  74. $header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  75. $header .= "Content-Transfer-Encoding: 7bitrnrn";
  76.  
  77. $header .= "--".$ui."rn";
  78. $header .= "Content-Type: ".$file_type."; name="".$file_name.""rn";
  79. $header .= "Content-Transfer-Encoding: base64rn";
  80. $header .= "Content-Disposition: attachment; filename="".$file_name.""rnrn";
  81. $header .= $content."rnrn";
  82.  
  83. if(mail($to, $asunto, $mensaje, $header)){
  84. echo "success";
  85. }else{
  86. echo "fallo el envio";
  87. }
  88.  
  89. }else{
  90. echo "El formato del archivo no es admitido";
  91. }
  92. }else{
  93. echo "No hay archivo adjuntado";
  94. }
  95. }
  96. ?>
Add Comment
Please, Sign In to add comment