本文整理汇总了PHP中PMA_log_user函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_log_user函数的具体用法?PHP PMA_log_user怎么用?PHP PMA_log_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_log_user函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_DBI_connect
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'];
$client_flags = 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;
/* Optionally compress connection */
if (defined('MYSQL_CLIENT_COMPRESS') && $cfg['Server']['compress']) {
$client_flags |= MYSQL_CLIENT_COMPRESS;
}
/* Optionally enable SSL */
if (defined('MYSQL_CLIENT_SSL') && $cfg['Server']['ssl']) {
$client_flags |= MYSQL_CLIENT_SSL;
}
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, $password, empty($client_flags) ? NULL : $client_flags);
// Retry with empty password if we're allowed to
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags);
}
if (empty($link)) {
if ($is_controluser) {
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
return false;
}
PMA_log_user($user, 'mysql-denied');
PMA_auth_fails();
}
// end if
PMA_DBI_postConnect($link, $is_controluser);
return $link;
}
示例2: PMA_DBI_connect
/**
* connects to the database server
*
* @uses $GLOBALS['cfg']['Server']
* @uses PMA_auth_fails()
* @uses PMA_DBI_postConnect()
* @uses MYSQLI_CLIENT_COMPRESS
* @uses MYSQLI_OPT_LOCAL_INFILE
* @uses strtolower()
* @uses mysqli_init()
* @uses mysqli_options()
* @uses mysqli_real_connect()
* @uses defined()
* @param string $user mysql user name
* @param string $password mysql user password
* @param boolean $is_controluser
* @return mixed false on error or a mysqli object on success
*/
function PMA_DBI_connect($user, $password, $is_controluser = false)
{
$server_port = empty($GLOBALS['cfg']['Server']['port']) ? false : (int) $GLOBALS['cfg']['Server']['port'];
if (strtolower($GLOBALS['cfg']['Server']['connect_type']) == 'tcp') {
$GLOBALS['cfg']['Server']['socket'] = '';
}
// NULL enables connection to the default socket
$server_socket = empty($GLOBALS['cfg']['Server']['socket']) ? null : $GLOBALS['cfg']['Server']['socket'];
$link = mysqli_init();
mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, true);
$client_flags = 0;
/* Optionally compress connection */
if ($GLOBALS['cfg']['Server']['compress'] && defined('MYSQLI_CLIENT_COMPRESS')) {
$client_flags |= MYSQLI_CLIENT_COMPRESS;
}
/* Optionally enable SSL */
if ($GLOBALS['cfg']['Server']['ssl'] && defined('MYSQLI_CLIENT_SSL')) {
$client_flags |= MYSQLI_CLIENT_SSL;
}
$return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, $password, false, $server_port, $server_socket, $client_flags);
// Retry with empty password if we're allowed to
if ($return_value == false && isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword'] && !$is_controluser) {
$return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, '', false, $server_port, $server_socket, $client_flags);
}
if ($return_value == false) {
if ($is_controluser) {
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
return false;
}
PMA_log_user($user, 'mysql-denied');
PMA_auth_fails();
}
// end if
PMA_DBI_postConnect($link, $is_controluser);
return $link;
}
示例3: PMA_DBI_connect
/**
* @param string $user mysql user name
* @param string $password mysql user password
* @param boolean $is_controluser
* @param array $server host/port/socket/persistant
* @param boolean $auxiliary_connection (when true, don't go back to login if connection fails)
* @return mixed false on error or a mysqli object on success
*/
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false)
{
global $cfg, $php_errormsg;
if ($server) {
$server_port = empty($server['port']) ? '' : ':' . (int) $server['port'];
$server_socket = empty($server['socket']) ? '' : ':' . $server['socket'];
$server_persistant = empty($server['persistant']) ? false : true;
} else {
$server_port = empty($cfg['Server']['port']) ? '' : ':' . (int) $cfg['Server']['port'];
$server_socket = empty($cfg['Server']['socket']) ? '' : ':' . $cfg['Server']['socket'];
}
if (strtolower($cfg['Server']['connect_type']) == 'tcp') {
$cfg['Server']['socket'] = '';
}
$client_flags = 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;
/* Optionally compress connection */
if (defined('MYSQL_CLIENT_COMPRESS') && $cfg['Server']['compress']) {
$client_flags |= MYSQL_CLIENT_COMPRESS;
}
/* Optionally enable SSL */
if (defined('MYSQL_CLIENT_SSL') && $cfg['Server']['ssl']) {
$client_flags |= MYSQL_CLIENT_SSL;
}
if (!$server) {
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, $password, empty($client_flags) ? NULL : $client_flags);
// Retry with empty password if we're allowed to
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags);
}
} else {
if (!isset($server['host'])) {
$link = PMA_DBI_real_connect($server_socket, $user, $password, NULL, $server_persistant);
} else {
$link = PMA_DBI_real_connect($server['host'] . $server_port . $server_socket, $user, $password, NULL, $server_persistant);
}
}
if (empty($link)) {
if ($is_controluser) {
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
return false;
}
// we could be calling PMA_DBI_connect() to connect to another
// server, for example in the Synchronize feature, so do not
// go back to main login if it fails
if (!$auxiliary_connection) {
PMA_log_user($user, 'mysql-denied');
PMA_auth_fails();
} else {
return false;
}
}
// end if
if (!$server) {
PMA_DBI_postConnect($link, $is_controluser);
}
return $link;
}
示例4: PMA_DBI_connect
// scripts)
$controllink = false;
if ($cfg['Server']['controluser'] != '') {
if (!empty($cfg['Server']['controlhost'])) {
$controllink = PMA_DBI_connect($cfg['Server']['controluser'], $cfg['Server']['controlpass'], true, array('host' => $cfg['Server']['controlhost']));
} else {
$controllink = PMA_DBI_connect($cfg['Server']['controluser'], $cfg['Server']['controlpass'], true);
}
}
// Connects to the server (validates user's login)
$userlink = PMA_DBI_connect($cfg['Server']['user'], $cfg['Server']['password'], false);
if (!$controllink) {
$controllink = $userlink;
}
/* Log success */
PMA_log_user($cfg['Server']['user']);
/**
* with phpMyAdmin 3 we support MySQL >=5
* but only production releases:
* - > 5.0.15
*/
if (PMA_MYSQL_INT_VERSION < 50015) {
PMA_fatalError(__('You should upgrade to %s %s or later.'), array('MySQL', '5.0.15'));
}
if (PMA_DRIZZLE) {
// DisableIS must be set to false for Drizzle, it maps SHOW commands
// to INFORMATION_SCHEMA queries anyway so it's fast on large servers
$cfg['Server']['DisableIS'] = false;
// SHOW OPEN TABLES is not supported by Drizzle
$cfg['SkipLockedTables'] = false;
}
示例5: PMA_DBI_connect
/**
* connects to the database server
*
* @param string $user mysql user name
* @param string $password mysql user password
* @param bool $is_controluser whether this is a control user connection
* @param array $server host/port/socket/persistent
* @param bool $auxiliary_connection (when true, don't go back to login if
* connection fails)
*
* @return mixed false on error or a mysqli object on success
*/
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false)
{
global $cfg;
if ($server) {
$server_port = empty($server['port']) ? false : (int) $server['port'];
$server_socket = empty($server['socket']) ? '' : $server['socket'];
$server['host'] = empty($server['host']) ? 'localhost' : $server['host'];
} else {
$server_port = empty($cfg['Server']['port']) ? false : (int) $cfg['Server']['port'];
$server_socket = empty($cfg['Server']['socket']) ? null : $cfg['Server']['socket'];
}
// NULL enables connection to the default socket
$link = mysqli_init();
mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, true);
$client_flags = 0;
/* Optionally compress connection */
if ($cfg['Server']['compress'] && defined('MYSQLI_CLIENT_COMPRESS')) {
$client_flags |= MYSQLI_CLIENT_COMPRESS;
}
/* Optionally enable SSL */
if ($cfg['Server']['ssl'] && defined('MYSQLI_CLIENT_SSL')) {
$client_flags |= MYSQLI_CLIENT_SSL;
}
if (!$server) {
$return_value = @PMA_DBI_real_connect($link, $cfg['Server']['host'], $user, $password, false, $server_port, $server_socket, $client_flags);
// Retry with empty password if we're allowed to
if ($return_value == false && isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword'] && !$is_controluser) {
$return_value = @PMA_DBI_real_connect($link, $cfg['Server']['host'], $user, '', false, $server_port, $server_socket, $client_flags);
}
} else {
$return_value = @PMA_DBI_real_connect($link, $server['host'], $user, $password, false, $server_port, $server_socket);
}
if ($return_value == false) {
if ($is_controluser) {
trigger_error(__('Connection for controluser as defined in your configuration failed.'), E_USER_WARNING);
return false;
}
// we could be calling PMA_DBI_connect() to connect to another
// server, for example in the Synchronize feature, so do not
// go back to main login if it fails
if (!$auxiliary_connection) {
PMA_log_user($user, 'mysql-denied');
global $auth_plugin;
$auth_plugin->authFails();
} else {
return false;
}
} else {
PMA_DBI_postConnect($link, $is_controluser);
}
return $link;
}