use the mysql connection function defined in the config. file
This commit is contained in:
@@ -16,6 +16,7 @@ $Source$
|
|||||||
* libraries/common.lib.php3; libraries/select_lang.lib.php3; index.php3;
|
* libraries/common.lib.php3; libraries/select_lang.lib.php3; index.php3;
|
||||||
left.php3; header.inc.php3: improved xhtml1.0 compliance.
|
left.php3; header.inc.php3: improved xhtml1.0 compliance.
|
||||||
* libraries/ob.lib.php3: applied coding standards.
|
* libraries/ob.lib.php3: applied coding standards.
|
||||||
|
* main.php3: use the mysql connection function defined in the config. file.
|
||||||
|
|
||||||
2001-09-20 Geert Lund <glund@silversoft.dk>
|
2001-09-20 Geert Lund <glund@silversoft.dk>
|
||||||
* security issue fix: added checking for valid user and password to the
|
* security issue fix: added checking for valid user and password to the
|
||||||
|
36
main.php3
36
main.php3
@@ -157,17 +157,30 @@ if ($server > 0
|
|||||||
$server_socket = (empty($cfgServer['socket']) || PHP_INT_VERSION < 30010)
|
$server_socket = (empty($cfgServer['socket']) || PHP_INT_VERSION < 30010)
|
||||||
? ''
|
? ''
|
||||||
: ':' . $cfgServer['socket'];
|
: ':' . $cfgServer['socket'];
|
||||||
$stdlink = @mysql_connect(
|
$bkp_track_err = (PHP_INT_VERSION >= 40000) ? @ini_set('track_errors', 1) : '';
|
||||||
|
$stdlink = @$connect_func(
|
||||||
$cfgServer['host'] . $server_port . $server_socket,
|
$cfgServer['host'] . $server_port . $server_socket,
|
||||||
$cfgServer['stduser'],
|
$cfgServer['stduser'],
|
||||||
$cfgServer['stdpass']
|
$cfgServer['stdpass']
|
||||||
);
|
);
|
||||||
if ($stdlink == FALSE) {
|
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 . '('
|
$local_query = $connect_func . '('
|
||||||
. $cfgServer['host'] . $server_port . $server_socket . ', '
|
. $cfgServer['host'] . $server_port . $server_socket . ', '
|
||||||
. $cfgServer['stduser'] . ', '
|
. $cfgServer['stduser'] . ', '
|
||||||
. $cfgServer['stdpass'] . ')';
|
. $cfgServer['stdpass'] . ')';
|
||||||
mysql_die('', $local_query, FALSE, FALSE);
|
mysql_die($conn_error, $local_query, FALSE, FALSE);
|
||||||
|
} else if (PHP_INT_VERSION >= 40000) {
|
||||||
|
@ini_set('track_errors', $bkp_track_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does user have global Create priv?
|
// Does user have global Create priv?
|
||||||
@@ -184,17 +197,30 @@ if ($server > 0
|
|||||||
// find, in most cases it's probably the one he just dropped :)
|
// 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)
|
// (Note: we only get here after a browser reload, I don't know why)
|
||||||
if (!$create) {
|
if (!$create) {
|
||||||
$userlink = @mysql_connect(
|
$bkp_track_err = (PHP_INT_VERSION >= 40000) ? @ini_set('track_errors', 1) : '';
|
||||||
|
$userlink = @$connect_func(
|
||||||
$cfgServer['host'] . $server_port . $server_socket,
|
$cfgServer['host'] . $server_port . $server_socket,
|
||||||
$cfgServer['user'],
|
$cfgServer['user'],
|
||||||
$cfgServer['password']
|
$cfgServer['password']
|
||||||
);
|
);
|
||||||
if ($userlink == FALSE) {
|
if ($userlink == FALSE) {
|
||||||
$local_query = 'mysql_connect('
|
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['host'] . $server_port . $server_socket . ', '
|
||||||
. $cfgServer['user'] . ', '
|
. $cfgServer['user'] . ', '
|
||||||
. $cfgServer['password'] . ')';
|
. $cfgServer['password'] . ')';
|
||||||
mysql_die('', $local_query, FALSE, FALSE);
|
mysql_die($conn_error, $local_query, FALSE, 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']) . '\'';
|
$local_query = 'SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
|
||||||
|
Reference in New Issue
Block a user