0
&& empty($cfgServer['only_db']))
{
?>
MySQL |
= 40000) ? @ini_set('track_errors', 1) : '';
$stdlink = @$connect_func(
$cfgServer['host'] . $server_port . $server_socket,
$cfgServer['stduser'],
$cfgServer['stdpass']
);
if ($stdlink == FALSE) {
if (mysql_error()) {
$conn_error = mysql_error();
} else if (isset($php_errormsg)) {
$conn_error = $php_errormsg;
} else {
$conn_error = 'Cannot connect: invalid settings.';
}
if (PHP_INT_VERSION >= 40000) {
@ini_set('track_errors', $bkp_track_err);
}
$local_query = $connect_func . '('
. $cfgServer['host'] . $server_port . $server_socket . ', '
. $cfgServer['stduser'] . ', '
. $cfgServer['stdpass'] . ')';
mysql_die($conn_error, $local_query, FALSE, '');
} else if (PHP_INT_VERSION >= 40000) {
@ini_set('track_errors', $bkp_track_err);
}
// Does user have global Create priv?
$local_query = 'SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
$rs_usr = mysql_query($local_query, $stdlink);
if ($rs_usr) {
$result_usr = mysql_fetch_array($rs_usr);
$create = ($result_usr['Create_priv'] == 'Y');
$db_to_create = '';
}
// Does user have Create priv on a inexistant db?
// if yes, show him in the dialog the first inexistant db name that we
// find, in most cases it's probably the one he just dropped :)
// (Note: we only get here after a browser reload, I don't know why)
if (!$create) {
$bkp_track_err = (PHP_INT_VERSION >= 40000) ? @ini_set('track_errors', 1) : '';
$userlink = @$connect_func(
$cfgServer['host'] . $server_port . $server_socket,
$cfgServer['user'],
$cfgServer['password']
);
if ($userlink == FALSE) {
if (mysql_error()) {
$conn_error = mysql_error();
} else if (isset($php_errormsg)) {
$conn_error = $php_errormsg;
} else {
$conn_error = 'Cannot connect: invalid settings.';
}
if (PHP_INT_VERSION >= 40000) {
@ini_set('track_errors', $bkp_track_err);
}
$local_query = $connect_func . '('
. $cfgServer['host'] . $server_port . $server_socket . ', '
. $cfgServer['user'] . ', '
. $cfgServer['password'] . ')';
mysql_die($conn_error, $local_query, FALSE, '');
} else if (PHP_INT_VERSION >= 40000) {
@ini_set('track_errors', $bkp_track_err);
}
$local_query = 'SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
$rs_usr = mysql_query($local_query, $stdlink);
if ($rs_usr) {
while ($row = mysql_fetch_array($rs_usr)) {
if (!mysql_select_db($row['Db'], $userlink)) {
$db_to_create = $row['Db'];
$create = TRUE;
break;
} // end if
} // end while
} // end if
mysql_free_result($rs_usr);
} // end if
// The user is allowed to create a db
if ($create) {
echo "\n";
?>
 |
|
 |
|
 |
|
 |
|
 |
|
 |
|
 |
|
 |
(*)
|
 |
|
 |
|
 |
|
 |
|
 |
|
 |
|
 |
|
|
|
0)
/**
* Displays the phpMyAdmin related links
*/
?>
|