Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. CREATE TABLE boletos (
  2. protocolo int(11) NOT NULL AUTO_INCREMENT,
  3. boleto mediumblob NOT NULL,
  4. nomeBoleto varchar(20) DEFAULT NULL,
  5. tipoBoleto varchar(20) DEFAULT NULL,
  6. PRIMARY KEY (protocolo));
  7.  
  8. <?php
  9. include "config.php";
  10. // Define o tempo máximo de execução em 0 para as conexões lentas
  11. set_time_limit(100);
  12.  
  13. $GerParam=filter_input(INPUT_GET, "protocolo" ,FILTER_DEFAULT);
  14. if(isset($_GET['protocolo'])){
  15. $protocolo = $_GET['protocolo'];
  16. $stat = $db->prepare("SELECT nomeBoleto,tipoBoleto,boleto FROM boletos WHERE protocolo=?");
  17.  
  18. $stat->execute(array($_GET['protocolo']));
  19. $stat->bindColumn(1, $nomeBoleto, PDO::PARAM_STR, 256);
  20. $stat->bindColumn(2, $tipoBoleto, PDO::PARAM_STR, 256);
  21. $stat->bindColumn(3, $boleto, PDO::PARAM_LOB);
  22. $stat->fetch(PDO::FETCH_BOUND);
  23.  
  24. header('Accept-Ranges: bytes');
  25. header('Content-Transfer-Encoding: binary');
  26. header("Content-Type: $tipoBoleto");
  27. header("Content-Disposition: attachment; filename=$nomeBoleto");
  28. echo $boleto;
  29.  
  30.  
  31. }
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement