patch #1592366, using a host name as a URL parameter

This commit is contained in:
Marc Delisle
2006-12-27 14:08:43 +00:00
parent 072f3b4abb
commit b7796e429c
3 changed files with 30 additions and 1 deletions

View File

@@ -5,6 +5,11 @@ phpMyAdmin - ChangeLog
$Id$
$HeadURL$
2006-12-27 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html, libraries/common.lib.php: patch #1592366,
possibility of using the host name as a parameter in the URL,
thanks to Arnold Daniels
2006-12-26 Marc Delisle <lem9@users.sourceforge.net>
* export.php: set $local_query only if we are exporting data
* export.php, libraries/export/latex.php, /sql.php, /htmlword.php,

View File

@@ -3169,6 +3169,11 @@ $cfg['Servers'][$i]['AllowDeny']['rules'] = array(
For example, a missing &quot;www&quot;, or entering with an <abbr title="Internet Protocol">IP</abbr> address
while a domain name is defined in the config file.</p>
<h4 id="faq4_8">
<a href="#faq4_8">4.8 Which parameters can I use in the URL that starts phpMyAdmin?</a></h4>
<p>When starting phpMyAdmin, you can use the <tt>db</tt>, <tt>pma_username</tt>, <tt>pma_password</tt> and <tt>server</tt> parameters. This last one can contain either the numeric host index (from <tt>$i</tt> of the configuration file) or one of the host names present in the configuration file. Using <tt>pma_username</tt> and <tt>pma_password</tt> has been tested along with the usage of 'cookie' <tt>auth_type</tt>.</p>
<h3 id="faqbrowsers">Browsers or client <abbr title="operating system">OS</abbr></h3>
<h4 id="faq5_1">

View File

@@ -3004,6 +3004,24 @@ if (! defined('PMA_MINIMUM_COMMON')) {
*/
require_once './libraries/string.lib.php';
/**
* Lookup server by name
* by Arnold - Helder Hosting
* (see FAQ 4.8)
*/
if (! empty($_REQUEST['server']) && is_string($_REQUEST['server']) && ! ctype_digit($_REQUEST['server'])) {
foreach ($cfg['Servers'] as $i => $server) {
if ($server['host'] == $_REQUEST['server']) {
$_REQUEST['server'] = $i;
break;
}
}
if (is_string($_REQUEST['server'])) {
unset($_REQUEST['server']);
}
unset($i);
}
/**
* If no server is selected, make sure that $cfg['Server'] is empty (so
* that nothing will work), and skip server authentication.
@@ -3012,7 +3030,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
* present a choice of servers in the case that there are multiple servers
* and '$cfg['ServerDefault'] = 0' is set.
*/
if (isset($_REQUEST['server']) && is_string($_REQUEST['server']) && ! empty($_REQUEST['server']) && ! empty($cfg['Servers'][$_REQUEST['server']])) {
if (isset($_REQUEST['server']) && (is_string($_REQUEST['server']) || is_numeric($_REQUEST['server'])) && ! empty($_REQUEST['server']) && ! empty($cfg['Servers'][$_REQUEST['server']])) {
$GLOBALS['server'] = $_REQUEST['server'];
$cfg['Server'] = $cfg['Servers'][$GLOBALS['server']];
} else {