Autologin problem

Help
2011-09-05
2016-02-02
  • Nobody/Anonymous

    Hey everyone!
    I have been using Adminer for a while now, but can't figure out how to use extensions (I need autologin)…
    I have created adminer_loader.php with the following code:

    <?php
            class AdminerSoftware extends Adminer {
                function credentials() {
                    // server, username and password for connecting to database
                    return array('database_host', 'database_user', 'database_password');
                }
                function database() {
                    // database name, will be escaped by Adminer
                    return 'selected_db';
                }
            }
            return new AdminerSoftware;
        }
        require_once("adminer.php");
    ?>
    

    When I open in browser adminer_loader.php I get standart login page

     
  • Nobody/Anonymous

    whoops forgot some code in earlier post:

    <?php
    function adminer_object() {
            class AdminerSoftware extends Adminer {
                function credentials() {
                    // server, username and password for connecting to database
                    return array('database_host', 'database_user', 'database_password');
                }
                function database() {
                    // database name, will be escaped by Adminer
                    return 'selected_db';
                }
            }
            return new AdminerSoftware;
        }
        require_once("adminer.php");
    ?>
    [code]
    
     
  • Jakub Vrána

    Jakub Vrána - 2011-09-05

    You need to pass ?username= in URL to skip the login form. Or you can set $_GET in adminer_loader.php (which is a hack).

     
  • Nobody/Anonymous

    and how do i pass password? trough URL I can pass only server, username and db…

     
  • Jakub Vrána

    Jakub Vrána - 2011-09-06

    Password is returned by credentials method.

     
  • Nobody/Anonymous

    could you give me example how to pass it through loader?

     
  • Jakub Vrána

    Jakub Vrána - 2011-09-17
     
  • Nobody/Anonymous

    I meant example how to use credentials method in loader ;)

     
  • Jakub Vrána

    Jakub Vrána - 2011-12-22

    You don't need to call credentials, just define it.

     
  • Alex

    Alex - 2016-01-07

    Hi,

    I'm afraid I don't understand how the credentials funciton is supposed to work.

    I can set up a wrapper to call Adminer from like so;

    # cat /app/adminer_islandora252.php
    <?php
      function adminer_object() {
          include_once "plugins/plugin.php";
          foreach (glob("plugins/*.php") as $filename) {
              include_once "./$filename";
          }
          $plugins = array(
              new AdminerFrames,
          );
          class AdminerCustomization extends AdminerPlugin {
            function credentials() {
              return array("127.0.0.1:33060", "1dc243b", "904967e");
            }
            function database() {
              return "786182c843f2b493674e8b3fbbb7f03d";
            }
          }
          return new AdminerCustomization($plugins);
      }
      include "adminer.php";
      ?>
    

    but the credentials seem to be ignored. I can hack it so that it passes the username, etc., in the URL, and this appears to work, but this seems unideal and defeats the purpose of the credentials function.

     
    Last edit: Alex 2016-01-25
  • Jakub Vrána

    Jakub Vrána - 2016-01-26

    You can pass ?username= in the URL to auto-login. You can also set $_GET['username'] = '' in your code.

     
  • Alex

    Alex - 2016-02-02

    Hey Jakub,

    Thanks for the quick response. I tried doing that, but it seemed as
    though I'd also have to pass password, port, and dbname in the URL the
    same way in order to make that method work -- which brings me back to
    confusion as to how the credentials method is supposed to work, since
    the documentation implies that it handles exactly this use case.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks