Plugin for Adminer, restricted login to config-defined server
Based on official (but not working at this time) login-servers for Adminer with enhancements.
And inspired by CrazyMax's login-servers-enhanced
- This plugin restricts user to connect only to ONE predefined server.
- User cannot choose anything. Only fill username and password. (other fields are not displayed nor send over network)
- User cannot (ab)use your server with your Adminer to connect somewhere else.
Copy plugins/forced-server.php
in the plugins folder.
Follow the instructions on the official plugins page.
Then just add new AdminerForcedServer
to the $plugins
array :
<?php
if (! isset($_SERVER['HTTPS'])) {
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}
function adminer_object() {
// required to run any plugin
include_once "./plugins/plugin.php";
// autoloader
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}
$plugins = array(
// specify enabled plugins here
new AdminerForcedServer(array('driver' => 'server', 'server' => 'localhost')),
);
return new AdminerPlugin($plugins);
}
// include original Adminer or Adminer Editor
include "./adminer.php";
?>
You must set array with keys 'driver' and 'server'.
Value for the driver is usually 'server'.
Value for server can be localhost, IP address or hostname of target server.
Apache-2.0. See LICENSE
for more details.