Skip to content

Instantly share code, notes, and snippets.

Created November 27, 2018 03:13
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Adminer with SQLite no-login

Adminer setup

Enables plugins, and SQLite no-login.


  1. Copy index.php to a new directory
  2. Download Adminer to adminer.php
  3. Create a plugins/ folder
  4. Download plugin to plugins/plugin.php
  5. Copy login-sqlite.php in plugins/
# File from
function adminer_object() {
// Required to run any plugin.
include_once(__DIR__ . "/plugins/plugin.php");
// Load plugins.
foreach (glob(__DIR__ . "/plugins/*.php") as $file) {
$plugins = [
new AdminerLoginSqlite()
return new AdminerPlugin($plugins);
// Include original Adminer or Adminer Editor.
include "./adminer.php";
# Place in `plugins/`
/** Enable auto-login for SQLite
* @link
* @author Jakub Vrana,
* @license Apache License, Version 2.0
* @license GNU General Public License, version 2 (one or other)
class AdminerLoginSqlite {
function login($login, $password) {
return true;
function loginForm() {
<script type="text/javascript">
addEventListener('load', function () {
var driver = document.getElementsByName('auth[driver]')[0];
if (isTag(driver, 'select')) {
driver.onchange = function () {
var trs = parentTag(driver, 'table').rows;
for (var i=1; i < trs.length - 1; i++) {
var disabled = /sqlite/.test(driver.value);
alterClass(trs[i], 'hidden', disabled);
trs[i].getElementsByTagName('input')[0].disabled = disabled;
# File `plugin` from
# Place in plugins/ folder
Copy link

iexa commented Apr 27, 2021

In recent adminer (after 4.4+) versions they have implemented CSP headers that basically send a nonce in the http headers (one-time only code), and compare it with the same nonce in script tags. If no match - no code runs. Easy fix after a bit of hunting around, just replace line 18 in login-sqlite.php with this one:

<script<?php echo nonce()?>>

You always learn something new.

Copy link

Thanks! It saved my time.

Copy link

Thanks very much! It worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment