$dbquery_errs = 0; $counter = 0; @mysqli_autocommit($dbh, false); while ($counter < $sql_result_file_length) { $query_strlen = strlen(trim($sql_result_file_data[$counter])); if ($dbvar_maxpacks < $query_strlen) { DUPX_Log::Info("**ERROR** Query size limit [length={$query_strlen}] [sql=" . substr($sql_result_file_data[$counter], 75) . "...]"); $dbquery_errs++; } elseif ($query_strlen > 0) { @mysqli_free_result(@mysqli_query($dbh, $sql_result_file_data[$counter])); $err = mysqli_error($dbh); //Check to make sure the connection is alive if (!empty($err)) { if (!mysqli_ping($dbh)) { mysqli_close($dbh); $dbh = DupUtil::db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname'], $_POST['dbport']); // Reset session setup @mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}"); DupUtil::mysql_set_charset($dbh, $_POST['dbcharset'], $_POST['dbcollate']); } DUPX_Log::Info("**ERROR** database error write '{$err}' - [sql=" . substr($sql_result_file_data[$counter], 0, 75) . "...]"); $dbquery_errs++; //Buffer data to browser to keep connection open } else { if ($fcgi_buffer_count++ > $fcgi_buffer_pool) { $fcgi_buffer_count = 0; DupUtil::fcgi_flush(); } $dbquery_rows++; } }
$_baseURL = strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; $_baseURL = "http://" . $_baseURL; header("HTTP/1.1 301 Moved Permanently"); header("Location: {$_baseURL}"); exit; } /* JSON RESPONSE: Most sites have warnings turned off by default, but if they're turned on the warnings cause errors in the JSON data Here we hide the status so warning level is reset at it at the end*/ $ajax2_error_level = error_reporting(); error_reporting(E_ERROR); //==================================================================================================== //DATABASE UPDATES //==================================================================================================== $ajax2_start = DupUtil::get_microtime(); //MYSQL CONNECTION $dbh = DupUtil::db_connect($_POST['dbhost'], $_POST['dbuser'], html_entity_decode($_POST['dbpass']), $_POST['dbname'], $_POST['dbport']); $charset_server = @mysqli_character_set_name($dbh); @mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}"); DupUtil::mysql_set_charset($dbh, $_POST['dbcharset'], $_POST['dbcollate']); //POST PARAMS $_POST['blogname'] = mysqli_real_escape_string($dbh, $_POST['blogname']); $_POST['postguid'] = isset($_POST['postguid']) && $_POST['postguid'] == 1 ? 1 : 0; $_POST['fullsearch'] = isset($_POST['fullsearch']) && $_POST['fullsearch'] == 1 ? 1 : 0; $_POST['path_old'] = isset($_POST['path_old']) ? trim($_POST['path_old']) : null; $_POST['path_new'] = isset($_POST['path_new']) ? trim($_POST['path_new']) : null; $_POST['siteurl'] = isset($_POST['siteurl']) ? rtrim(trim($_POST['siteurl']), '/') : null; $_POST['tables'] = isset($_POST['tables']) && is_array($_POST['tables']) ? array_map('stripcslashes', $_POST['tables']) : array(); $_POST['url_old'] = isset($_POST['url_old']) ? trim($_POST['url_old']) : null; $_POST['url_new'] = isset($_POST['url_new']) ? rtrim(trim($_POST['url_new']), '/') : null; //LOGGING $POST_LOG = $_POST;