Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Informações da conexão com o banco
- $dbhost = "localhost";
- $dbuser = "root";
- $dbpwd = "lovefear";
- $dbname = "loja";
- $dumpfile = "backup-sistema" . "_" . date("Y-m-d_H-i-s") . ".sql";
- // Comando para gerar o dump
- $command = "mysqldump --user=$dbhost --password=$dbuser --host=$dbpwd $dbname > $dumpfile";
- exec($command);
- echo $command;
- // Setando o nome do dump na variavel
- $file = $dumpfile;
- // Forçando o navegador a fazer o download
- //header("Content-Description: File Transfer");
- //header("Content-Type: application/octet-stream");
- //header("Content-Disposition: attachment; filename='" . basename($file) . "'");
- // Abrindo o arquivo no navegador
- //readfile ($file);
- // Removendo o temporário da pasta
- //unlink ($file);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement