本文整理匯總了PHP中DupUtil::db_connect方法的典型用法代碼示例。如果您正苦於以下問題:PHP DupUtil::db_connect方法的具體用法?PHP DupUtil::db_connect怎麽用?PHP DupUtil::db_connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DupUtil
的用法示例。
在下文中一共展示了DupUtil::db_connect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: while
$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++;
}
}
示例2: strlen
$_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;