SHARE
TWEET

Untitled

a guest Jun 17th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. require("dbconnect.inc.php");
  3.  
  4. $qry = "SELECT protocolo,nomeBoleto,categoria,hr_dt_inserido FROM boletos";
  5. $res = mysqli_query($con, $qry);
  6.  
  7. while($fila = mysqli_fetch_array($res))
  8. {
  9. print "$fila[protocolo]
  10.  
  11. <br>
  12. $fila[nomeBoleto] ($fila[categoria])
  13. <br>
  14. <a href='baixar_arquivo.php?protocolo=$fila[protocolo]'>Fazer Download</a>
  15. <br>
  16.  
  17.  
  18. ";}
  19.  
  20.  
  21. ?>
  22.      
  23. <?php
  24.  
  25. require("dbconnect.inc.php");
  26. require("listar_arquivos.php");
  27.  
  28. $protocolo= $_GET['protocolo'];
  29. $sql = "SELECT nomeBoleto, boleto FROM boletos WHERE protocolo='".$protocolo."'";
  30. $result = mysqli_query($con, $sql);
  31.  
  32. if(mysqli_num_rows ($result) > 0 ){
  33.     while($registro = mysqli_fetch_assoc($result)){
  34.  
  35. $FILENAME =$registro['nomeBoleto'];
  36. $SFILEPATH = $registro['boleto'];
  37.  
  38. header("Content-Disposition: attachment; filename={$FILENAME}");
  39. header("Content-Transfer-Encoding: binary");
  40. header('Expires: 0');
  41. header('Pragma: no-cache');
  42.  
  43. // Envia o arquivo para o cliente
  44. readfile($FILEPATH);
  45. }
  46. }
  47. else{
  48.     print "Não existe arquivos a serem baixados";
  49. }
  50.  ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top