1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
global $cfg, $php_errormsg;
$server_port = (empty($cfg['Server']['port']))
? ''
: ':' . $cfg['Server']['port'];
if (strtolower($cfg['Server']['connect_type']) == 'tcp') {
$cfg['Server']['socket'] = '';
}
$server_socket = (empty($cfg['Server']['socket']))
? ''
: ':' . $cfg['Server']['socket'];
if (PMA_PHP_INT_VERSION >= 40300 && PMA_MYSQL_CLIENT_API >= 32349) {
$client_flags = $cfg['Server']['compress'] && defined('MYSQL_CLIENT_COMPRESS') ? MYSQL_CLIENT_COMPRESS : 0;
// always use CLIENT_LOCAL_FILES as defined in mysql_com.h
// for the case where the client library was not compiled
// with --enable-local-infile
$client_flags |= 128;
}
if (empty($client_flags)) {
$connect_func = 'mysql_' . ($cfg['PersistentConnections'] ? 'p' : '') . 'connect';
$link = @$connect_func($cfg['Server']['host'] . $server_port . $server_socket, $user, $password);
} else {
if ($cfg['PersistentConnections']) {
$link = @mysql_pconnect($cfg['Server']['host'] . $server_port . $server_socket, $user, $password, $client_flags);
} else {
$link = @mysql_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, $password, FALSE, $client_flags);
}
}
if (empty($link)) {
PMA_auth_fails();
} // end if
PMA_DBI_postConnect($link, $is_controluser);
mysql_query("SET SESSION CHARACTER_SET_RESULTS =latin1;",$link);
mysql_query("SET SESSION CHARACTER_SET_CLIENT =latin1;",$link);
return $link;
} |
Partager