Enables plugins, and SQLite no-login.
- Copy
index.php
to a new directory - Download Adminer to
adminer.php
- Create a
plugins/
folder - Download
plugin
toplugins/plugin.php
- Copy
login-sqlite.php
inplugins/
<?php | |
# File from https://www.adminer.org/en/#download |
<?php | |
function adminer_object() { | |
// Required to run any plugin. | |
include_once(__DIR__ . "/plugins/plugin.php"); | |
// Load plugins. | |
foreach (glob(__DIR__ . "/plugins/*.php") as $file) { | |
include_once($file); | |
} | |
$plugins = [ | |
new AdminerLoginSqlite() | |
]; | |
return new AdminerPlugin($plugins); | |
} | |
// Include original Adminer or Adminer Editor. | |
include "./adminer.php"; |
<?php | |
# Place in `plugins/` | |
/** Enable auto-login for SQLite | |
* @link https://www.adminer.org/plugins/#use | |
* @author Jakub Vrana, https://www.vrana.cz/ | |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 | |
* @license http://www.gnu.org/licenses/gpl-2.0.html 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; | |
} | |
}; | |
} | |
driver.onchange(); | |
}); | |
</script> | |
<?php | |
} | |
} |
<?php | |
# File `plugin` from https://www.adminer.org/en/plugins/ | |
# Place in plugins/ folder |
Thanks! It saved my time.
Thanks very much! It worked.
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.