create.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. require_once('../common/ImtMail.php');
  3. $method = $_GET['method'];
  4. $pdfName = $_GET['name'];
  5. $userId = $_GET['id'];
  6. $lang = $_GET['lang'];
  7. if (isset($_GET['mail']))
  8. $mailParam = $_GET['mail'];
  9. $ff=fopen("pdfDownloadStats.txt", "a+");
  10. fprintf($ff, "id=%s\n", $userId);
  11. fclose($ff);
  12. if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ))
  13. {
  14. // get bytearray
  15. $pdf = $GLOBALS["HTTP_RAW_POST_DATA"];
  16. if (isset($mailParam) && $mailParam)
  17. {
  18. $subject = "IntimaMedia.com : IMT pdf";
  19. if ($lang == 'fr')
  20. $message = "<HTML><HEAD></HEAD><BODY>Bonjour<br/><br/>Vous venez de recevoir un rapport pdf en provenance de l'application IntimaMedia.com.<br/><br/>Cordialement.</BODY></HTML>";
  21. else
  22. $message = "<HTML><HEAD></HEAD><BODY>Hello<br/><br/>Please, find in attachment a IMT pdf report.<br/><br/>Best regards.</BODY></HTML>";
  23. $emails = explode(';', $mailParam);
  24. for ($i=0; $i<sizeof($emails); $i++)
  25. {
  26. if ($emails[$i])
  27. ImtMail::sendMail($emails[$i], "support@intimamedia.com", "support@intimamedia.com", $subject, $message, $lang, "imt.pdf", "application/pdf", $pdf);
  28. }
  29. }
  30. // add headers for download dialog-box
  31. header('Content-Type: application/pdf');
  32. header('Content-Length: '.strlen($pdf)+1);
  33. header('Content-disposition:'.$method.'; filename="'.$pdfName.'"');
  34. echo $pdf;
  35. }
  36. else
  37. echo 'An error occured.';
  38. ?>