23 lines
No EOL
533 B
PHP
23 lines
No EOL
533 B
PHP
<?php
|
|
|
|
$DBUSER = $_GET["dbuser"];
|
|
$DBPASSWD = $_GET["dbpasswd"];
|
|
$DATABASE = $_GET["database"];
|
|
#echo("$DBUSER, $DBPASSWD, $DATABASE");
|
|
//http://localhost:8005/backup?dbuser=user&dbpasswd=passwd&database=db1
|
|
|
|
|
|
$filename = "backup-" . date("d-m-Y") . ".sql.gz";
|
|
echo($filename);
|
|
$mime = "application/x-gzip";
|
|
|
|
header( "Content-Type: " . $mime );
|
|
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
|
|
|
|
$cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip --best";
|
|
|
|
passthru( $cmd );
|
|
|
|
exit(0);
|
|
|
|
?>
|