Adminer Editor for SQLite

Anonymous
2011-04-15
2014-05-06
  • Anonymous - 2011-04-15

    I could not figure out how to use Adminer Editor for SQLite database. When I try to login using my server credentials, it automatically opens my MySQL database for one of my blogs. I couldnot see an option to open an SQLite database unlike in Adminer.

    This project is great but one thing is lacking -> Good Documentation.

    Your documentation is so vague and instructions are too vague that only the author understands it for himself.

     
  • Anonymous - 2011-04-15

    When writing documentations or instructions, a good author does not always assume that his readers will understand everything. it would be better if you write a documentation in HTML or Pdf format.

     
  • Jakub Vrána

    Jakub Vrána - 2011-04-17

    Currently, using Adminer Editor with other database systems is little tricky. You have to define own loginForm method specifying the driver. Like this:

    function loginForm() {
        ?>
    <table cellspacing="0">
    <tr><th><?php echo lang('Username'); ?><td><input type="hidden" name="driver" value="sqlite"><input type="hidden" name="server" value="localhost"><input id="username" name="username" value="<?php echo h($_GET["username"]);  ?>">
    <tr><th><?php echo lang('Password'); ?><td><input type="password" name="password">
    </table>
    <?php
        echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
        echo checkbox("permanent", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
    }
    

    Thank you for your feedback, I've added this information to the documentation. Please let me know in which other ways can be the documentation improved.

     
    • Adam Fishman

      Adam Fishman - 2014-05-06

      I tried this and it does not work. Can you provide a complete index.php that will open a sqlite database called merchant.db.

      There is only one table, itmfil.

      Please help. I have tried all the suggestions and no luck. I will need a complete index.php file with the adminer_object

       
  • gmtfn

    gmtfn - 2011-05-05

    Hi,

    I have the same problem. I did that (as I understood it): created a new PHP file, defined this function in it, (just as you wrote it here), included editor.php and… got no change - the editor still assumes that I want to use MySQL. Do you think you could provide a package that is ready for working with SQLite databases? This would be easier for users and you because nobody would ask this question again.

     
  • gmtfn

    gmtfn - 2011-05-05

    I've spent much more time trying to get this work (by guessing, essentially) for SQLite, and here's my feedback: software shouldn't be developed (or released, more accurately) if it's meant for human users who aren't developers of the software.

     
  • Jakub Vrána

    Jakub Vrána - 2011-05-06

    loginForm is not a global function, it's a method of the Adminer object. Take a look at documentation.

    Adminer Editor is a tool for developers for simple development of administration interfaces. This combined product is targeted for common users with no knowledge of programming at all.

     
  • gmtfn

    gmtfn - 2011-05-06

    I've later added this function as a method to the object, per instructions on the extension page, but that didn't work either.

    I want to assure you that "common users with no knowledge of programming at all" could not use your tool to manage SQLite. I am a programmer but couldn't make it work.

    Developing a product for "common users with no knowledge of programming at all" takes more love (i.e. willingness to get out of your box and look at things from the point of view of your targeted users so that you could deliver what they could use. phpLiteAdmin (http://code.google.com/p/phpliteadmin/) has turned out to be MUCH better. I has worked out of the box on my local dev machine but took some programming to work around a bug on a production system. However, I couldn't make your software work.

     
  • Jakub Vrána

    Jakub Vrána - 2011-05-06

    phpLiteAdmin is a competitor for Adminer, not Adminer Editor. I really don't understand why are you trying to use Adminer Editor which I've already said is a tool for developers to easily create an administration interface for end-users which shouldn't alter the database (like your secretary).

    Using Adminer is super-simple - run the file and choose the driver and the database directly in the web application.

     
  • gmtfn

    gmtfn - 2011-05-07

    I am not sure why I was trying to use Adminer Editor. I guess I had gotten confused about the difference between that and Adminer. Now that I've tried Adminer, I agree that it is very simple to use with no need to modify anything. Thanks for the clarification!

     
  • Haagen Waade

    Haagen Waade - 2011-05-12

    I am trying to get Adminer Editor to work with a sqlite database, but cannot get it to work.
    I have gotten Adminer to work though, so should not be far away.
    I have modified the editor-3.2.2.php to say <input type="hidden" name="driver" value="sqlite">
    But where do I specify what .sqlite file I want to use? I tried the server field with no success..

     
  • Jakub Vrána

    Jakub Vrána - 2011-05-12

    It's better to create a customization - upgrades would be much easier then. http://www.adminer.org/en/extension/

    Specify the database in the

    database
    

    method.

     
  • Haagen Waade

    Haagen Waade - 2011-05-12

    I have also done that, but with no success even if I only changed the driver field in the editor.php file.

    Here is my modified line in editor.php file:

    loginForm(){echo'<table cellspacing="0">
    <tr><th>',lang(20),'<td><input type="hidden" name="driver" value="sqlite"><input type="hidden" name="server" value="localhost"><input id="username" name="username" value="',h($_GET["username"]),'">
    

    And here is my index.php file:

    <?php
    function adminer_object() {
        
        class AdminerSoftware extends Adminer {
            
            function name() {
                // custom name in title and heading
                return 'db';
            }
            
            function permanentLogin() {
                // key used for permanent login
                return "5f504fe1fdd79083c5435740d1d5263b";
            }
            
            function credentials() {
                // server, username and password for connecting to database
                return array('people.sqlite', '', '');
            }
            
            function database() {
                // database name, will be escaped by Adminer
                return 'cbm_people';
            }
            
            function login($login, $password) {
                // validate user submitted credentials
                return ($login == 'admin' && $password == 'test');
            }
            
            function tableName($tableStatus) {
                // tables without comments would return empty string and will be ignored by Adminer
                //return h($tableStatus["cbm_people"]);
            }
            
            function fieldName($field, $order = 0) {
                // only columns with comments will be displayed and only the first five in select
                //return ($order <= 5 && !ereg('_(md5|sha1)$', $field["field"]) ? h($field["comment"]) : "");
            }
            
        }
        
        return new AdminerSoftware;
    }
    include "./editor.php";
    ?>
    
     
  • Haagen Waade

    Haagen Waade - 2011-05-12

    Figured database should be the file, and not the table, and no I do not get no tables anymore.
    But still does not list out any tables to edit. Maybe I havent understood tableName and fieldName correctly..
    If those are not specified, do you not get access to anything then? What should I do to make the user allow to edit the table cbm_people ?

     
  • Jakub Vrána

    Jakub Vrána - 2011-05-12

    Do not copy-paste code which you don't understand. Do not edit editor.php. All you have to do is to define database method returning filename of your SQLite database and loginForm method specifying that you are using SQLite. There is no need to define other methods.

     
  • Haagen Waade

    Haagen Waade - 2011-05-12

    Sorry, I misunderstood your previous post!
    Defining the loginform is ofcorse done in the index file, with all other customizations.

    Now it works beautiful.
    Great little script, very handy.
    Thanks for the support!

     
  • Anonymous - 2012-08-01

    I had the same problem,even after adding the loginForm function, it did not work.

    The reason could be that the login form in Editor is using POST rather than GET method. or maybe for other reasons.

    Anyway it worked for me like this:

    1) Define database method returning filename of your SQLite database in a new file 'index.php'

    <?php
    function adminer_object() {   
        class AdminerSoftware extends Adminer {
            function database() {
                return 'D:\Web_Server\www\FH_iTWO32.sqlite';
            }  
    }
         return new AdminerSoftware;
    }
    include "editor.php"; // or editor-3.4.0.php what ever the version which u r using
    ?>

    and then instead of adding the loginForm, i am using a direct url to login like this :

    http://localhost/index.php?sqlite=&username=

    hope this will help somehow

     
  • Haagen Waade

    Haagen Waade - 2014-01-07

    After upgrading to 3.7.1 I did not get the index.php to work and had to solve it as Anonymous from 2012.
    Too bad I could not make use of the login feature of Adminer Editor though.

     
  • Adam Fishman

    Adam Fishman - 2014-05-06

    I have had no luck in getting the adminereditor to work with sqlite.

    Can anyone provide a working index.php file that works with sqlite?

    I am using version 4.1.0

     
    Last edit: Adam Fishman 2014-05-07

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

Sign up for the SourceForge newsletter:





No, thanks