#333 (ok 2.10) Use server name in request instead of server index

closed-accepted
None
1
2007-02-28
2006-11-08
No

It is very useful if you can use
'phpmyadmin/index.php?server=SERVERNAME' the sameway u
use 'phpmyadmin/index.php?db=DBNAME'. Unfortunatly
currently you can only supply a server index (which
ofcourse is unknown to other applications).
This simple patch looks up the index if
$_REQUEST['server'] is a string.

I could really appreciate if this small piece of code
could end up in the distribution.

--- File: libraries/common.lib.php -----

/** ADDED CODE */

/*
* Lookup server by name
* Added by Arnold - Helder Hosting
*/
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']);
}

/** END OF ADDED CODE **/

/**
* If no server is selected, make sure that
$cfg['Server'] is empty (so
* that nothing will work), and skip server
authentication.
* We do NOT exit here, but continue on without
logging into any server.
* This way, the welcome page will still come up
(with no server info) and
* present a choice of servers in the case that
there are multiple servers
* and '$cfg['ServerDefault'] = 0' is set.
*/
if (!empty($_REQUEST['server']) &&
!empty($cfg['Servers'][$_REQUEST['server']])) {
$GLOBALS['server'] = $_REQUEST['server'];
....

Discussion

  • Marc Delisle

    Marc Delisle - 2006-12-10
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2006-12-10

    Logged In: YES
    user_id=210714
    Originator: NO

    I agree to merge this but I would like to explain it in Documentation.html. I understand that you want to call phpMyAdmin from another app but how do you deal with the token that phpMyAdmin now requires?

     
  • Marc Delisle

    Marc Delisle - 2006-12-11

    Logged In: YES
    user_id=210714
    Originator: NO

    So the goal is to reach the login page with the correct server name chosen?

     
  • Arnold Daniels

    Arnold Daniels - 2006-12-11

    Logged In: YES
    user_id=1585726
    Originator: YES

    No it isn't, at least not exactly. I didn't supply the correct password, thats why you get the login screen when following the
    The server request var will select the correct server. When you supply pma_username and pma_password, you will login directly. Supplying the db var selects the correct db, instead of showing the normal start page. This all already works with PhpMyAdmin. The only problem it that you need to supply a server id (numeric) instead of a server name. The server id is unique to PhpMyAdmin, it's not logical that an other application would know this. This patch simply allows you to pass the server name as well as the server id.

     
  • Arnold Daniels

    Arnold Daniels - 2006-12-11

    Logged In: YES
    user_id=1585726
    Originator: YES

    The first sentence should read:

    No it isn't, at least not exactly. I didn't supply the correct password,
    thats why you get the login screen when following the url.

     
  • Marc Delisle

    Marc Delisle - 2006-12-27
    • priority: 5 --> 1
    • summary: Use server name in request instead of server index --> (ok 2.10) Use server name in request instead of server index
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2006-12-27

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged for 2.10, thanks. Note that in 2.10 there is also a new 'signon' auth_type that permits to log in from prepared session data.

     
  • Marc Delisle

    Marc Delisle - 2007-02-28
    • status: open-accepted --> closed-accepted
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks