} else { $db_list = $_POST['db']; } // get all available databases $available_dbs = PMBP_get_db_list(); // always backup all dbs in scheduled mode, if the system variable is set if ($mode == "incl" && $PMBP_SYS_VAR["schedule_all_dbs"]) { $db_list = $available_dbs; } // is a database selected? if ($db_list) { foreach ($db_list as $export_db) { // check if $export_db is available if (in_array($export_db, $available_dbs)) { // generate db dump $backupfile = PMBP_dump($export_db, $_POST['tables'] == "on", $_POST['data'] == "on", $_POST['drop'] == "on", $_POST['zip'], $_POST['comments']); // is there no db connection or a db missing? if ($backupfile && $backupfile !== "DB_ERROR") { // change mode to 0777 @chmod("./" . $backupfile, 0777); // remind filenames if backup by ftp or email is selected if ($CONF['email_use'] && function_exists("mail") || $CONF['ftp_use'] && function_exists("ftp_connect")) { $store_files[] = PMBP_EXPORT_DIR . $backupfile; } if ($mode == "web") { echo "<div class=\"green\">" . EX_SAVED . " " . $backupfile . "</div>\n"; } elseif ($mode == "shell") { echo EX_SAVED . " " . $backupfile . "\n"; } elseif ($mode == "incl") { $out .= EX_SAVED . " " . $backupfile . "<br>\n"; }
public function makeBackupOfToday() { $this->deleteOldBackups(); $F = new File(Util::getRootPath() . "system/Backup/.htaccess"); $F->loadMe(); if ($F->getA() == null) { file_put_contents($F->getID(), "AuthUserFile " . Util::getRootPath() . "system/Backup/.htpasswd\nAuthGroupFile /dev/null\nAuthName \"Restricted\"\nAuthType Basic\n<Limit GET>\nrequire valid-user\n</Limit>"); file_put_contents(Util::getRootPath() . "system/Backup/.htpasswd", "Restricted:kV.RuW/ox2sc2" . mt_rand(0, 20000000)); } require Util::getRootPath() . "libraries/PMBP.inc.php"; $CONF = array(); $CONF['sql_host'] = $_SESSION["DBData"]["host"]; $CONF['sql_user'] = $_SESSION["DBData"]["user"]; $CONF['sql_passwd'] = $_SESSION["DBData"]["password"]; $CONF['date'] = "d.m.Y"; $CONF['sql_db'] = $_SESSION["DBData"]["datab"]; define("PMBP_EXPORT_DIR", Util::getRootPath() . "system/Backup/"); define('PMBP_VERSION', "v.2.1"); define('PMBP_WEBSITE', "http://www.phpMyBackupPro.net"); $PMBP_SYS_VAR = array(); $PMBP_SYS_VAR["except_tables"] = ""; $filename = PMBP_dump($CONF, $PMBP_SYS_VAR, $_SESSION["DBData"]["datab"], true, true, false, false, ""); chmod(Util::getRootPath() . "system/Backup/" . $filename, 0666); return $filename; }