From e5c814c7fc9979b86a4bb1cefe43872d3d5e783b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sat, 13 Apr 2002 19:38:13 +0000 Subject: [PATCH] Patch #542421 - dynamic server numbers in config file --- ChangeLog | 2 + Documentation.html | 61 +++++++++++++------------- Documentation.txt | 66 ++++++++++++++-------------- config.inc.php3 | 104 +++++++++++++++++++++++---------------------- 4 files changed, 121 insertions(+), 112 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab21f0a47..d186a90d6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ $Source$ * db_stats.php3; left.php3; libraries/display_tbl.lib.php3: the valid xhtml attribute to display the "tool tip" of an image is "title" and not "alt". * libraries/display_tbl.lib.php3, lines 574 & 578: use localized strings. + * config.inc.php3; Documentation.*: merged patch #542421 - dynamic server + numbers in config file. 2002-04-12 Loïc Chapeaux * libraries/display_tbl.lib.php3, lines 957-991: expended cosmetic changes diff --git a/Documentation.html b/Documentation.html index a1203fe09..fa2b6d25f 100755 --- a/Documentation.html +++ b/Documentation.html @@ -276,8 +276,8 @@ & "Timestamp") tables.
You must specify the details for the controluser in the config.inc.php3 file under the - $cfgServers[n]['controluser'] & - $cfgServers[n]['controlpass'] settings.
+ $cfgServers[$i]['controluser']& + $cfgServers[$i]['controlpass'] settings.
This example assumes you want to use pma as the controluser and pmapass as the controlpass:
@@ -339,10 +339,10 @@

'config' authentication mode:

@@ -396,35 +396,36 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' Since version 1.4.2, phpMyAdmin supports the administration of multiple MySQL servers. Therefore, a $cfgServers-array has been added which contains the login - information for the different servers. $cfgServers[1]['host'] - contains the hostname of the first server, - $cfgServers[2]['host'] the hostname of the second server, etc. + information for the different servers. The first + $cfgServers[$i]['host'] contains the hostname of the first + server, the second $cfgServers[$i]['host'] the hostname of the + second server, etc. If you have only one server to administer, simply leave free the hostname of the other $cfgServer-entries.

-
$cfgServers[n]['host'] string
+
$cfgServers[$i]['host'] string
- The hostname of your n-th MySQL-server. E.g. localhost. + The hostname of your $i-th MySQL-server. E.g. localhost.

-
$cfgServers[n]['port'] string
+
$cfgServers[$i]['port'] string
- The port-number of your n-th MySQL-server. Default is 3306 (leave + The port-number of your $i-th MySQL-server. Default is 3306 (leave blank).

-
$cfgServers[n]['socket'] string
+
$cfgServers[$i]['socket'] string
The path to the socket to use. Leave blank for default.
To use the socket feature you must run php 3.0.10 or more.

-
$cfgServers[n]['connect_type'] string
+
$cfgServers[$i]['connect_type'] string
What type connection to use with the MySQL server. Your options are 'socket' & 'tcp'. It defaults to 'tcp' as that is nearly guarenteed @@ -434,8 +435,8 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
- $cfgServers[n]['controluser'] string
- $cfgServers[n]['controlpass'] string + $cfgServers[$i]['controluser'] string
+ $cfgServers[$i]['controlpass'] string
When using http or cookie authentication modes (or 'config' @@ -459,7 +460,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'

-
$cfgServers[n]['auth_type'] string ['http'|'cookie'|'config']
+
$cfgServers[$i]['auth_type'] string ['http'|'cookie'|'config']
Whether config or cookie or http authentication should be used for this server. @@ -492,8 +493,8 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
- $cfgServers[n]['user'] string
- $cfgServers[n]['password'] string + $cfgServers[$i]['user'] string
+ $cfgServers[$i]['password'] string
The user/password-pair which phpMyAdmin will use to connect to this @@ -501,7 +502,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' authentication is used, and should be empty.

-
$cfgServers[n]['only_db'] string or array
+
$cfgServers[$i]['only_db'] string or array
If set to a(an array of) database name(s), only this(these) database(s) will be shown to the user. Since phpMyAdmin 2.2.1, this/these @@ -518,7 +519,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'

-
$cfgServers[n]['verbose'] string
+
$cfgServers[$i]['verbose'] string
Only useful when using phpMyAdmin with multiple server entries. If set, this string will be displayed instead of the hostname in the pulldown @@ -528,8 +529,8 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
- $cfgServers[n]['bookmarkdb'] string
- $cfgServers[n]['bookmarktable'] string + $cfgServers[$i]['bookmarkdb'] string
+ $cfgServers[$i]['bookmarktable'] string
Since release 2.2.0 phpMyAdmin allows to bookmark queries. This can be @@ -552,8 +553,8 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
  • then complete the two variables - $cfgServers[n]['bookmarkdb'] and - $cfgServers[n]['bookmarktable'] with the database and + $cfgServers[$i]['bookmarkdb'] and + $cfgServers[$i]['bookmarktable'] with the database and table names you've choosen so phpMyAdmin will be able to find the bookmarks.
  • @@ -568,7 +569,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
    - $cfgServers[n]['relation'] string + $cfgServers[$i]['relation'] string
    Since release 2.2.4 you can describe, in a special 'relation' table, @@ -606,7 +607,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
  • put the relation table name in - $cfgServers[n]['relation'] + $cfgServers[$i]['relation']
  • then manually fill the relation table with information about @@ -1201,7 +1202,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3.
    For example: - $cfgServers[n]['socket'] = '/tmp/mysql.sock'; + $cfgServers[$i]['socket'] = '/tmp/mysql.sock';
  • @@ -1310,8 +1311,8 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'

    • - $cfgServers[n]['controluser'] and/or - $cfgServers[n]['controlpass'] are wrong. + $cfgServers[$i]['controluser'] and/or + $cfgServers[$i]['controlpass'] are wrong.
    • The username/password you specify in the login-dialog are invalid. diff --git a/Documentation.txt b/Documentation.txt index 09ca218b0..ccf990f32 100644 --- a/Documentation.txt +++ b/Documentation.txt @@ -7,8 +7,8 @@ + Version history: [2]ChangeLog + General notes: [3]README + License: [4]LICENSE - * Documentation version: $Id: Documentation.html,v 1.191 2002/04/10 - 12:40:09 lem9 Exp $ + * Documentation version: $Id: Documentation.html,v 1.192 2002/04/10 + 20:24:35 loic1 Exp $ ______________________________________________________________________ [5]Top - [6]Requirements - [7]Introduction - [8]Installation - @@ -118,8 +118,8 @@ Installation except "Password"), mysql.db (all columns) & mysql.tables_priv (all columns except "Grantor" & "Timestamp") tables. You must specify the details for the controluser in the - config.inc.php3 file under the $cfgServers[n]['controluser'] & - $cfgServers[n]['controlpass'] settings. + config.inc.php3 file under the $cfgServers[$i]['controluser']& + $cfgServers[$i]['controlpass'] settings. This example assumes you want to use pma as the controluser and pmapass as the controlpass: @@ -162,9 +162,10 @@ Installation 'config' authentication mode: * This mode is the less secure one because it requires you to fill - the $cfgServers[n]['user'] and $cfgServers[n]['password'] fields. + the $cfgServers[$i]['user'] and $cfgServers[$i]['password'] + fields. But you don't need to setup a "controluser" here: using the - $cfgServers[n]['only_db'] might be enough. + $cfgServers[$i]['only_db'] might be enough. In the ISP FAQ section, there is an entry explaining how to protect your configuration file. ______________________________________________________________________ @@ -200,30 +201,31 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' Since version 1.4.2, phpMyAdmin supports the administration of multiple MySQL servers. Therefore, a $cfgServers-array has been added which contains the login information for the different - servers. $cfgServers[1]['host'] contains the hostname of the - first server, $cfgServers[2]['host'] the hostname of the second - server, etc. If you have only one server to administer, simply - leave free the hostname of the other $cfgServer-entries. + servers. The first $cfgServers[$i]['host'] contains the + hostname of the first server, the second + $cfgServers[$i]['host'] the hostname of the second server, etc. + If you have only one server to administer, simply leave free + the hostname of the other $cfgServer-entries. - $cfgServers[n]['host'] string - The hostname of your n-th MySQL-server. E.g. localhost. + $cfgServers[$i]['host'] string + The hostname of your $i-th MySQL-server. E.g. localhost. - $cfgServers[n]['port'] string - The port-number of your n-th MySQL-server. Default is 3306 + $cfgServers[$i]['port'] string + The port-number of your $i-th MySQL-server. Default is 3306 (leave blank). - $cfgServers[n]['socket'] string + $cfgServers[$i]['socket'] string The path to the socket to use. Leave blank for default. To use the socket feature you must run php 3.0.10 or more. - $cfgServers[n]['connect_type'] string + $cfgServers[$i]['connect_type'] string What type connection to use with the MySQL server. Your options are 'socket' & 'tcp'. It defaults to 'tcp' as that is nearly guarenteed to be available on all MySQL servers, while sockets are not supported on some platforms. - $cfgServers[n]['controluser'] string - $cfgServers[n]['controlpass'] string + $cfgServers[$i]['controluser'] string + $cfgServers[$i]['controlpass'] string When using http or cookie authentication modes (or 'config' authentication mode since phpMyAdmin 2.2.1), you need to supply the details of a MySQL account that has SELECT privilege on the @@ -239,7 +241,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' support a direct login with the "controluser". In versions before 2.2.5, those were called "stduser/stdpass". - $cfgServers[n]['auth_type'] string ['http'|'cookie'|'config'] + $cfgServers[$i]['auth_type'] string ['http'|'cookie'|'config'] Whether config or cookie or http authentication should be used for this server. @@ -257,13 +259,13 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' Please see the install section on "Using authentication modes" for more information. - $cfgServers[n]['user'] string - $cfgServers[n]['password'] string + $cfgServers[$i]['user'] string + $cfgServers[$i]['password'] string The user/password-pair which phpMyAdmin will use to connect to this MySQL-server. This user/password pair is not needed when http or cookie authentication is used, and should be empty. - $cfgServers[n]['only_db'] string or array + $cfgServers[$i]['only_db'] string or array If set to a(an array of) database name(s), only this(these) database(s) will be shown to the user. Since phpMyAdmin 2.2.1, this/these database(s) name(s) may contain MySQL wilcards @@ -277,15 +279,15 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' means only these databases will be displayed but not at all other databases can't be used. - $cfgServers[n]['verbose'] string + $cfgServers[$i]['verbose'] string Only useful when using phpMyAdmin with multiple server entries. If set, this string will be displayed instead of the hostname in the pulldown menu on the main page. This can be useful if you want to show only certain databases on your system, for example. - $cfgServers[n]['bookmarkdb'] string - $cfgServers[n]['bookmarktable'] string + $cfgServers[$i]['bookmarkdb'] string + $cfgServers[$i]['bookmarktable'] string Since release 2.2.0 phpMyAdmin allows to bookmark queries. This can be useful for queries you often run. To use this functionality you have to: @@ -299,8 +301,8 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' query text NOT NULL, PRIMARY KEY (id) ); - + then complete the two variables $cfgServers[n]['bookmarkdb'] - and $cfgServers[n]['bookmarktable'] with the database and + + then complete the two variables $cfgServers[$i]['bookmarkdb'] + and $cfgServers[$i]['bookmarktable'] with the database and table names you've choosen so phpMyAdmin will be able to find the bookmarks. @@ -310,7 +312,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' GRANT SELECT,INSERT,DELETE ON . to 'pma'@localhost; - $cfgServers[n]['relation'] string + $cfgServers[$i]['relation'] string Since release 2.2.4 you can describe, in a special 'relation' table, which field is a key in another table (a foreign key). phpMyAdmin currently uses this to @@ -333,7 +335,7 @@ $cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://' `dest_column` varchar(32) NOT NULL default '', PRIMARY KEY (`src_table`,`src_column`) ) TYPE=MyISAM COMMENT='Table Relation'; - + put the relation table name in $cfgServers[n]['relation'] + + put the relation table name in $cfgServers[$i]['relation'] + then manually fill the relation table with information about the keys. @@ -695,7 +697,7 @@ FAQ - Frequently Asked Questions socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3. - For example: $cfgServers[n]['socket'] = '/tmp/mysql.sock'; + For example: $cfgServers[$i]['socket'] = '/tmp/mysql.sock'; Have also a look at the [55]corresponding section of the MySQL documentation. @@ -766,8 +768,8 @@ FAQ - Frequently Asked Questions phpMyAdmin always gives "Access denied" when using http authentication. This could happen for several reasons: - * $cfgServers[n]['controluser'] and/or $cfgServers[n]['controlpass'] - are wrong. + * $cfgServers[$i]['controluser'] and/or + $cfgServers[$i]['controlpass'] are wrong. * The username/password you specify in the login-dialog are invalid. * You have already setup a security mechanism for the phpMyAdmin-directory, eg. a .htaccess file. This would interfere diff --git a/config.inc.php3 b/config.inc.php3 index 0a78a9108..4c665c778 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -36,60 +36,64 @@ $cfgPmaAbsoluteUri = ''; /** * Server(s) configuration */ +$i = 0; // The $cfgServers array starts with $cfgServers[1]. Do not use $cfgServers[0]. // You can disable a server config entry by setting host to ''. -$cfgServers[1]['host'] = 'localhost'; // MySQL hostname -$cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port -$cfgServers[1]['socket'] = ''; // Path to the socket - leave blank for default socket -$cfgServers[1]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') -$cfgServers[1]['controluser'] = ''; // MySQL control user settings - // (this user must have read-only -$cfgServers[1]['controlpass'] = ''; // access to the "mysql/user" - // and "mysql/db" tables) -$cfgServers[1]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)? -$cfgServers[1]['user'] = 'root'; // MySQL user -$cfgServers[1]['password'] = ''; // MySQL password (only needed - // with 'config' auth_type) -$cfgServers[1]['only_db'] = ''; // If set to a db-name, only - // this db is displayed - // at left frame - // It may also be an array - // of db-names -$cfgServers[1]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname -$cfgServers[1]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support -$cfgServers[1]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support -$cfgServers[1]['relation'] = ''; // table to describe the relation between links (see doc) - // - leave blank for no relation-links support +$i++; +$cfgServers[$i]['host'] = 'localhost'; // MySQL hostname +$cfgServers[$i]['port'] = ''; // MySQL port - leave blank for default port +$cfgServers[$i]['socket'] = ''; // Path to the socket - leave blank for default socket +$cfgServers[$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') +$cfgServers[$i]['controluser'] = ''; // MySQL control user settings + // (this user must have read-only +$cfgServers[$i]['controlpass'] = ''; // access to the "mysql/user" + // and "mysql/db" tables) +$cfgServers[$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)? +$cfgServers[$i]['user'] = 'root'; // MySQL user +$cfgServers[$i]['password'] = ''; // MySQL password (only needed + // with 'config' auth_type) +$cfgServers[$i]['only_db'] = ''; // If set to a db-name, only + // this db is displayed + // at left frame + // It may also be an array + // of db-names +$cfgServers[$i]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname +$cfgServers[$i]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support +$cfgServers[$i]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support +$cfgServers[$i]['relation'] = ''; // table to describe the relation between links (see doc) + // - leave blank for no relation-links support -$cfgServers[2]['host'] = ''; -$cfgServers[2]['port'] = ''; -$cfgServers[2]['socket'] = ''; -$cfgServers[2]['connect_type'] = 'tcp'; -$cfgServers[2]['controluser'] = ''; -$cfgServers[2]['controlpass'] = ''; -$cfgServers[2]['auth_type'] = 'config'; -$cfgServers[2]['user'] = 'root'; -$cfgServers[2]['password'] = ''; -$cfgServers[2]['only_db'] = ''; -$cfgServers[2]['verbose'] = ''; -$cfgServers[2]['bookmarkdb'] = ''; -$cfgServers[2]['bookmarktable'] = ''; -$cfgServers[2]['relation'] = ''; +$i++; +$cfgServers[$i]['host'] = ''; +$cfgServers[$i]['port'] = ''; +$cfgServers[$i]['socket'] = ''; +$cfgServers[$i]['connect_type'] = 'tcp'; +$cfgServers[$i]['controluser'] = ''; +$cfgServers[$i]['controlpass'] = ''; +$cfgServers[$i]['auth_type'] = 'config'; +$cfgServers[$i]['user'] = 'root'; +$cfgServers[$i]['password'] = ''; +$cfgServers[$i]['only_db'] = ''; +$cfgServers[$i]['verbose'] = ''; +$cfgServers[$i]['bookmarkdb'] = ''; +$cfgServers[$i]['bookmarktable'] = ''; +$cfgServers[$i]['relation'] = ''; -$cfgServers[3]['host'] = ''; -$cfgServers[3]['port'] = ''; -$cfgServers[3]['socket'] = ''; -$cfgServers[3]['connect_type'] = 'tcp'; -$cfgServers[3]['controluser'] = ''; -$cfgServers[3]['controlpass'] = ''; -$cfgServers[3]['auth_type'] = 'config'; -$cfgServers[3]['user'] = 'root'; -$cfgServers[3]['password'] = ''; -$cfgServers[3]['only_db'] = ''; -$cfgServers[3]['verbose'] = ''; -$cfgServers[3]['bookmarkdb'] = ''; -$cfgServers[3]['bookmarktable'] = ''; -$cfgServers[3]['relation'] = ''; +$i++; +$cfgServers[$i]['host'] = ''; +$cfgServers[$i]['port'] = ''; +$cfgServers[$i]['socket'] = ''; +$cfgServers[$i]['connect_type'] = 'tcp'; +$cfgServers[$i]['controluser'] = ''; +$cfgServers[$i]['controlpass'] = ''; +$cfgServers[$i]['auth_type'] = 'config'; +$cfgServers[$i]['user'] = 'root'; +$cfgServers[$i]['password'] = ''; +$cfgServers[$i]['only_db'] = ''; +$cfgServers[$i]['verbose'] = ''; +$cfgServers[$i]['bookmarkdb'] = ''; +$cfgServers[$i]['bookmarktable'] = ''; +$cfgServers[$i]['relation'] = ''; // If you have more than one server configured, you can set $cfgServerDefault // to any one of them to autoconnect to that server when phpMyAdmin is started,