echo "<td> </td><td> </td>\n"; echo "</tr><tr>"; echo "<td><br><div class=\"bold_left\">" . C_TITLE_CONFIG . "</div></td><td colspan=\"7\"><br><hr></td>\n"; echo "</tr><tr>"; echo "<td>" . C_TIMELIMIT . " (" . F_SECONDS . ")*:</td><td>" . PMBP_config_print("timelimit") . "</td>\n"; echo "<td>" . C_CONFIRM . "*:</td><td>" . PMBP_config_print("confirm") . "</td>\n"; echo "<td>" . C_IMPORT_ERROR . ":</td><td>" . PMBP_config_print("import_error") . "</td>\n"; echo "<td> </td><td> </td>\n"; echo "</tr><tr>"; echo "<td>" . C_DIR_BACKUP . ":</td><td>" . PMBP_config_print("dir_backup") . "</td>\n"; echo "<td>" . C_DIR_REC . ":</td><td>" . PMBP_config_print("dir_rec") . "</td>\n"; echo "<td>[" . C_NO_LOGIN . ":</td><td>" . PMBP_config_print("no_login") . "]</td>\n"; echo "<td> </td><td> </td>\n"; echo "</tr>"; } elseif (isset($_GET['sys'])) { echo PMBP_addOutput(PMBP_C_SYS_WARNING, "red"); $i = 0; foreach ($PMBP_SYS_VAR as $key => $value) { if ($i % 2 == 0) { echo "<tr>\n"; } echo "<td colspan=\"2\">" . $key . ":</td><td colspan=\"2\"><input type=\"text\" size=\"20\" name=\"" . $key . "\" value=\"" . $value . "\"></td>\n"; if ($i % 2 == 1) { echo "</tr>"; } $i++; } if ($i % 2) { echo "</tr>\n"; } } else {
} } } } if (!$key && isset($_FILES['sql_file']['filename'])) { echo "======== " . $_FILES['sql_file']['name'] . " ========<br>\n"; } } } // print errors and final message if the import was not fragmented if (!isset($_POST['fragmented'])) { // print errors or message of success if ($sql_error) { echo PMBP_addOutput(SQ_ERROR . " " . $sql_error, "red_left"); } else { echo PMBP_addOutput(SQ_SUCCESS, "green_left"); } // print execution duration if (function_exists("microtime")) { $microtime = explode(" ", microtime()); $endtime = $microtime[0] + $microtime[1]; } else { $endtime = time(); } echo "<div class=\"bold_left\">" . F_DURATION . ": " . number_format($endtime - $starttime, 3) . " " . F_SECONDS . "</div><br><br>\n"; } } // print html form and show last selected database and last queries echo "<form action=\"sql_query.php\" method=\"post\" name=\"sql\" enctype=\"multipart/form-data\">\n<div>\n"; echo "<div class=\"bold_left\">" . SQ_WARNING . "</div>\n"; // print database select
} // all sql queries executed echo "<tr><td colspan=\"2\"> </td></tr>\n"; echo "<tr><td colspan=\"2\" class=\"active\">" . PMBP_addOutput(BI_END, "green_left"); // delete the temporary created file if (!$_GET['delete']) { if (file_exists($_GET["fn"] . ".zip")) { echo "<br>(<a href=\"" . $_SERVER["PHP_SELF"] . "?fn=" . $_GET["fn"] . ".zip&dbn=" . $_GET['dbn'] . "\">" . BI_RESTART . "" . basename($_GET['fn']) . ".zip</a>)</td></tr>\n"; } else { echo "<br>(<a href=\"" . $_SERVER["PHP_SELF"] . "?fn=" . $_GET["fn"] . "&dbn=" . $_GET['dbn'] . "\">" . BI_RESTART . "" . basename($_GET['fn']) . "</a>)</td></tr>\n"; } } echo "</table>\n"; } else { // restart script to execute next queries echo "<tr><td colspan=\"2\"> </td></tr>\n"; echo "<tr><td colspan=\"2\" class=\"active\">" . PMBP_addOutput(BI_SCRIPT_RUNNING, "red_left") . "</td></tr>\n"; echo "</table>\n"; echo "<script language=\"JavaScript\" type=\"text/javascript\">window.setTimeout('location.href=\"" . $_SERVER["PHP_SELF"] . "?fn=" . $_GET["fn"]; echo "&dbn=" . $_GET['dbn'] . "&delete=" . $_GET['delete'] . "&start=" . $linenumber . "&foffset=" . $foffset . "&totalqueries=" . $totalqueries . "&sn=" . $_GET['sn'] . "\";',500);</script>\n"; echo "<noscript>\n"; $link = $_SERVER["PHP_SELF"] . "?delete=" . $_GET['delete'] . "&start=" . $linenumber . "&fn=" . $_GET["fn"] . "&foffset=" . $foffset . "&dbn=" . $_GET['dbn'] . "&totalqueries=" . $totalqueries . "&sn=" . $_GET['sn']; echo PMBP_addOutput("<a href=\"" . $link . "\">" . BI_CONTINUE . " " . $linenumber . "</a> (" . BI_ENABLE_JS . "!)", "red_left"); echo "</noscript>\n"; } } } if ($error) { echo "<tr><td colspan=\"2\">" . PMBP_addOutput($error, "red_left") . "</td></tr>"; } echo "</table></body>\n</html>";
if ($PMBP_SYS_VAR['EXS_scheduled_file'] != "???.php") { echo " (<a href=\"\">" . PMBP_pop_up("get_file.php?view=" . $_POST['path'] . $PMBP_SYS_VAR['EXS_scheduled_file'], B_VIEW, "view") . "</a>)"; } echo "</form>"; echo "\n<a href=\"scheduled.php\"> <- " . EXS_BACK . "</a>\n"; // update specific settings for scheduled backups if ($_POST['path'] != $PMBP_SYS_VAR['EXS_scheduled_dir'] or $_POST['period'] != $PMBP_SYS_VAR['EXS_period']) { $PMBP_SYS_VAR['EXS_scheduled_dir'] = $_POST['path']; $PMBP_SYS_VAR['EXS_period'] = $_POST['period']; } // save PMBP_SYS_VARS PMBP_save_export_settings(); // print instructions and export form } else { if (isset($selection_ok) && isset($_POST['period'])) { echo PMBP_addOutput(EX_NO_DB . "!", "red"); } echo "<form name=\"backup\" action=\"scheduled.php\" method=\"post\">\n<div>\n"; echo EXS_PERIOD . ":<br>\n"; echo "<select name=\"period\">\n"; if ($PMBP_SYS_VAR['EXS_period'] == "*0") { $selected = " selected"; } else { $selected = ""; } echo "<option value=\"*0\"" . $selected . ">" . PMBP_EXS_ALWAYS . "</option>\n"; echo "<option>---------------------</option>\n"; if ($PMBP_SYS_VAR['EXS_period'] == "/24") { $selected = " selected"; } else { $selected = "";
$out .= $msg; } else { echo $msg; } } } else { $msg = PMBP_addOutput(sprintf(PMBP_EX_NO_AVAILABLE, $export_db), "red"); if ($mode == "incl") { $out .= $msg; } else { echo $msg; } } } } else { $smg = PMBP_addOutput(EX_NO_DB, "red"); if ($mode == "incl") { $out .= $msg; } else { echo $msg; } } // start backup using ftp or email $backup_info = array("comments" => $_POST['comments'], "tables" => $_POST['tables'] == "on", "data" => $_POST['data'] == "on", "drop" => $_POST['drop'] == "on", "comp" => $_POST['zip']); if ($CONF['ftp_use'] && isset($store_files)) { $out .= PMBP_FTP_store($store_files); } if ($CONF['email_use'] && isset($store_files)) { $out .= PMBP_email_store($store_files, $backup_info); } // file backup per FTP
function PMBP_shutdown_handler($buffer) { global $mode; if (connection_status() == 1 || connection_status() == 3) { // $buffer .= "user abborted!"; } if (connection_status() == 2 || connection_status() == 3) { $buffer .= "<br>" . PMBP_addOutput(F_TIMEOUT, "red"); if (isset($mode) && $mode == "web") { $buffer .= "<br><br>\n"; $buffer .= "<div class=\"bold\"><- <a href=\"javascript:history.back()\">" . EXS_BACK . "</a></div>"; } } return $buffer; }
function empty_single_db($db_name) { $db = mysql_select_db($db_name); if (!$db) { echo PMBP_addOutput(sprintf(PMBP_EX_NO_AVAILABLE, $db_name), "red"); } else { $res = mysql_list_tables($db_name); $tables_and_views = PMBP_list_tables_and_view(); startTransaction(); foreach ($tables_and_views['views'] as $view) { mysql_query("drop view `" . $view['Name'] . "`"); echo mysql_error(); } foreach ($tables_and_views['tables'] as $table) { mysql_query("drop table `" . $table['Name'] . "`"); echo mysql_error(); } endTransaction(); $error = mysql_error(); if ($error) { echo $error; } else { echo PMBP_addOutput(B_EMPTIED, "green"); } } }
} } else { $php = PMBP_I_NO_RES; } if (!($memory_limit = ini_get("memory_limit"))) { $memory_limit = PMBP_I_NO_RES; } if (function_exists("ftp_connect")) { $ftp = F_YES; } else { $ftp = PMBP_addOutput(F_NO, "red_left"); } if (function_exists("mail")) { $mail = F_YES; } else { $mail = PMBP_addOutput(F_NO, "red_left"); } if (function_exists("gzopen")) { $gzip = F_YES; } else { $gzip = F_NO; } if (!function_exists("mysql_get_server_info")) { $mysql_s = PMBP_I_NO_RES; } else { $mysql_s = @mysql_get_server_info(); } if (!function_exists("mysql_get_client_info")) { $mysql_c = PMBP_I_NO_RES; } else { $mysql_c = @mysql_get_client_info();
// get number of rows and size of tables $stati = mysql_query("show table status", $con); while ($status = @mysql_fetch_array($stati)) { $data_size += $status['Data_length'] + $status['Index_length']; $num_rows += $status['Rows']; } $size = PMBP_size_type($data_size); // get number of tables $num_tables = mysql_affected_rows($con); // first field for the db name echo "<tr " . PMBP_change_color("#FFFFFF", "#000000") . ">"; echo "\n<th class=\"active\">\n" . $db_name; if ($num_tables > 0) { echo "<span class=\"standard\">" . PMBP_pop_up("db_info.php?table=" . $db_name, " [" . DB_TABLES . "]", "view") . "</span>"; } elseif ($num_tables < 0) { $num_tables = PMBP_addOutput(C_WRONG_DB, "red"); } echo "\n</th>\n"; echo "<td class=\"list\">" . $num_tables . "</td>\n"; echo "<td class=\"list\">" . $num_rows . "</td>\n"; echo "<td class=\"list\">" . $size['value'] . " " . $size['type'] . "</td>\n"; } // show execution duration if (function_exists("microtime")) { $microtime = explode(" ", microtime()); $endtime = $microtime[0] + $microtime[1]; } else { $endtime = time(); } echo "<tr>\n<td colspan=\"4\">\n<br><div class=\"bold_left\">" . F_DURATION . ": " . number_format($endtime - $starttime, 3) . " " . F_SECONDS . "</div>\n" . DB_DIFF . "\n</td>\n</tr>\n"; } else {
} } $result = PMBP_delete_backup_files($del_files); if (!$result) { echo PMBP_addOutput(B_DELETED_ALL, "green"); } else { echo PMBP_addOutput($result, "red"); } } // delete selected backup file if the link was clicked if ($_GET['del']) { $out = PMBP_delete_backup_files($_GET['del']); if ($out) { echo $out; } else { echo PMBP_addOutput(B_DELETED, "green"); } } // get new list of backup files $all_files = PMBP_get_backup_files(); echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\">\n"; // list all backup files if (is_array($all_files)) { $last_backup = 0; $size_sum = 0; // print html table foreach ($all_files as $filename) { $file = PMBP_EXPORT_DIR . $filename; // generate one row for the db name if (!isset($printed_title[$db = PMBP_file_info("db", $file)])) { $printed_title[$db] = TRUE;