Re: MySQL Database backup

From: Date: Mon, 27 Aug 2001 20:03:14 +0000
Subject: Re: MySQL Database backup
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-64690@lists.php.net to get a copy of this message
I didn't want to cron the backup, just when the admin does :). Thanks anyway and here is the solution i came up with: It's based on a prior answer (thanks, Chris L.) and a pror discussion about forcing download in IE 5.5: <? $result=mysqldump -hmy.host.com -u username -ppassword dbname; header("Content-Type: application/x-octet-stream"); header("Content-Description: MySQLDatabaseBackup File"); echo $result; ?> This will work with IE 5.0, 5.5, NN6, NN4 (PC-Windows98/Me/2000) and NN4 (PC-RH Linux). But I don't think the platform or browser is guilty about trying to open without asking first, just the applications it recognizes (the web plugins installed), right? ----- Original Message ----- From: "Alex Sofronie" <maxx@mail.dntis.ro> To: "PHP General" <php-general@lists.php.net>; "Augusto Cesar Castoldi" <accastoldi@yahoo.com.br> Sent: Monday, August 27, 2001 7:40 PM Subject: Re: [PHP] MySQL Database backup > > This script uses the MyPHPAdmin > > (http://phpwizard.net/projects/phpMyAdmin/) dump, he > > "fopen" the php script of MyAdmin (tbl_dump.php) and > > write to a file the "result". This is the script > > > > ------------------------------------------------ > > function backup($url, $file) > > { > > if (file_exists($file)) > > unlink($file); > > if ($fd = fopen($url, "r")) > > { > > $aux = fread($fd, 10000000); > > fclose($fd); > > $fd = fopen($file, "aw" ); > > fwrite($fd, $aux); > > fclose($fd); > > } else { > > $fd = fopen("logs.txt", "aw"); > > fwrite($fd, "\n\nErro na URL: $url\n\n"); > > fclose($fd); > > } > > } > > $file = "fiesc.sql"; > > $url = > > > "http://$vendaval/libs/phpadmin2/tbl_dump.php?drop=1&showcolumns=yes&use_bac > kquotes=1&what=data&server=1&lang=pt-br&db=fiesc"; > > backup($url, $file); > > -------------------------------------------------- > > > > see you, > > > > Augusto > > > > > > > > > > --- Alex Sofronie <maxx@mail.dntis.ro> escreveu: > I > > tried find a solution to backup a mysql database > > > using php but i didn't > > > find anything but the binary file transfer solution > > > (just open and binary > > > copy all the files in my database directory). But > > > this is not a desired > > > solution because it involves some security holes > > > that I cannot afford. > > > Can anyone tell me where can i learn more about > > > this? Or some simple :) and > > > security holes free solution? > > > > > > Thanks all. > > > Alex Sofronie > > > maxx@mail.dntis.ro > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: > > > php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: > > > php-general-help@lists.php.net > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > > > > > ____________________________________________________________________________ > ___________________ > > Yahoo! GeoCities > > Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! > GeoCities. É fácil e grátis! > > http://br.geocities.yahoo.com/ > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#64690) next »