Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Autologin problem

Help
2011-09-05
2013-06-06
  • 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

     
  • 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).

     
  • 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.

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

     
  • Jakub Vrána
    Jakub Vrána
    2011-09-17

     
  • 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.