break; } } } // if no db connection possible if (isset($_SESSION['sql_host_org'])) { if (!@mysql_connect($_SESSION['sql_host_org'], $_SESSION['sql_user_org'], $_SESSION['sql_passwd_org'])) { echo PMBP_addOutput(C_WRONG_SQL, "red"); } if ($_SESSION['sql_db_org']) { if (!@mysql_select_db($_SESSION['sql_db_org'])) { echo PMBP_addOutput(C_WRONG_DB, "red"); } } } else { if (!PMBP_mysql_connect()) { echo PMBP_addOutput(C_WRONG_SQL, "red"); } if ($CONF['sql_db']) { if (!@mysql_select_db($CONF['sql_db'])) { echo PMBP_addOutput(C_WRONG_DB, "red"); } } } // only if 'good internet connection' and if no ftp connection possible if ($CONF['ftp_use'] || $CONF['dir_backup']) { if (!$CONF['ftp_server']) { echo PMBP_addOutput(C_WRONG_FTP, "red"); // check only if internet connection seems to be good } elseif (!$_SESSION['PMBP_VERSION']) { if (!($conn_id = @ftp_connect($CONF['ftp_server'], $CONF['ftp_port'], $PMBP_SYS_VAR['ftp_timeout']))) {
header("Location: index.php"); } PMBP_print_header(preg_replace("#.*/#", "", $_SERVER['SCRIPT_NAME'])); // used variables $sql_print = FALSE; if (!isset($_POST['sql_query'])) { $_POST['sql_query'] = FALSE; } if (!isset($_POST['sql_file'])) { $_POST['sql_file'] = FALSE; } if (!isset($_FILES['sql_file'])) { $_FILES['sql_file'] = FALSE; } // if first use or no db-connection is possible if (!($con = PMBP_mysql_connect())) { echo PMBP_addOutput(I_SQL_ERROR, "red_left") . "<br>"; } // if sql_query was send to db if (($_POST['sql_query'] || $_FILES['sql_file']) && $_POST['db']) { // get start time to calculate duration if (function_exists("microtime")) { $microtime = explode(" ", microtime()); $starttime = $microtime[0] + $microtime[1]; } else { $starttime = time(); } // set php timelimit @set_time_limit($CONF['timelimit']); @ignore_user_abort(TRUE); // get the submited file
if (!isset($_GET['dbn'])) { $_GET['dbn'] = " "; } if (!isset($_GET['delete'])) { $_GET['delete'] = false; } if (!isset($_GET['start']) || !isset($_GET['foffset'])) { $_GET['start'] = $_GET['foffset'] = 0; $firstSession = TRUE; $linenumber = 0; $foffset = 0; $totalqueries = 0; } // connect to the database if (!isset($firstSession)) { $con = PMBP_mysql_connect(); if (!$con) { $error = C_WRONG_SQL; } if (!$error) { $db = @mysql_select_db($_GET['dbn']); } if (!$db) { $error = C_WRONG_DB . " (" . $_GET['dbn'] . ")"; } } // open the file if (!$error && !isset($firstSession)) { // gzopen can be used for plain text too! // extract zip file if (PMBP_file_info("comp", $_GET["fn"]) == "zip") {
function PMBP_get_db_list() { global $CONF; // if there is given the name of a single database if ($CONF['sql_db']) { PMBP_mysql_connect(); if (@mysql_select_db($CONF['sql_db'])) { $dbs = array($CONF['sql_db']); } else { $dbs = array(); } return $dbs; } // else try to get a list of all available databases on the server $list = array(); PMBP_mysql_connect(); $db_list = @mysql_list_dbs(); while ($row = @mysql_fetch_array($db_list)) { if (@mysql_select_db($row['Database'])) { $list[] = $row['Database']; } } return $list; }