Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. // Informações da conexão com o banco
  4. $dbhost = "localhost";
  5. $dbuser = "root";
  6. $dbpwd = "lovefear";
  7. $dbname = "loja";
  8. $dumpfile = "backup-sistema" . "_" . date("Y-m-d_H-i-s") . ".sql";
  9.  
  10. // Comando para gerar o dump
  11. $command = "mysqldump --user=$dbhost --password=$dbuser --host=$dbpwd $dbname > $dumpfile";
  12.  
  13. exec($command);
  14. echo $command;
  15. // Setando o nome do dump na variavel
  16. $file = $dumpfile;
  17.  
  18. // Forçando o navegador a fazer o download
  19. //header("Content-Description: File Transfer");
  20. //header("Content-Type: application/octet-stream");
  21. //header("Content-Disposition: attachment; filename='" . basename($file) . "'");
  22.  
  23. // Abrindo o arquivo no navegador
  24. //readfile ($file);
  25.  
  26. // Removendo o temporário da pasta
  27. //unlink ($file);
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement