bkidwell/adminer-sqlite-login

Login plugin for Adminer to access SQLite databases authenticated with a global password.

1.0.3 2021-10-17 02:32 UTC

This package is not auto-updated.

Last update: 2024-04-15 12:06:41 UTC


README

This project provides a login plugin for Adminer to access SQLite databases in Adminer, which is a PHP web application for no-nonsense database administration. The plugin allows you to set a global password for all database types that don't support their own authentication mechanism.

Installing Adminer and this Plugin Using Composer

Pre-requisites:

  • PHP
  • Composer
  • PHP and Composer available in your $PATH environment variable.

Installation:

cd $PROJECTS
composer create-project bkidwell/adminer-sqlite-login
cd adminer-sqlite-login
composer install
php vendor/vrana/adminer/compile.php
php src/AdminerLoginSqlite.php setpassword
# Your password hash will be stored in src/AdminerLoginSqlite.conf.php .

To start Adminer:

cd $ADMINER # the folder where you installed adminer-login-sqlite
# change "8000" to your preferred port
php -d display_errors=1 -S localhost:8000 -t src

Alternative Installation without Using Composer

Pre-requisites:

  • PHP
  • PHP available in your $PATH environment variable.

Installation:

  1. Create a project folder, hereafter referred to as $ADMINER.
  2. Get a single-file Adminer build from https://www.adminer.org/en/#download and save it in $ADMINER as adminer.php.
  3. Copy plugin.php from the Adminer source code repository to $ADMINER.
  4. Copy AdminerSqliteLogin.php from its source code repository to $ADMINER.
  5. Create $ADMINER/index.php as follows:

     <?php
     require_once './AdminerLoginSqlite.php';
    
     function adminer_object() {
         require_once './plugin.php';
         return new AdminerPlugin([
             // specify enabled plugins here
             new AdminerLoginSqlite(),
         ]);
     }
    
     require 'adminer.php';
    
  6. Set your password:

     cd $ADMINER
     # Your password hash will be stored in AdminerLoginSqlite.conf.php .
     php AdminerLoginSqlite.php setpassword
    

You should have 4 files in $ADMINER now:

  • adminer.php
  • plugin.php
  • AdminerSqliteLogin.php
  • index.php

To start Adminer:

cd $ADMINER
# change "8000" to your preferred port
php -d display_errors=1 -S localhost:8000 -t .

Logging in

System: SQLite 3
Username:leave blank
Password:the password you set with the setpassword command
Database:absolute path to your database

Don't forget if you need to start with an empty SQLite file, a zero-lenght file is a valid SQLite database:

touch /home/user/databases/project.sqlite3