Files
adminer/plugins/login-servers.php

43 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/** Display constant list of servers in login form
2015-09-08 09:23:25 -07:00
* @link https://www.adminer.org/plugins/#use
2017-02-27 13:43:33 +01:00
* @author Jakub Vrana, https://www.vrana.cz/
2018-01-14 11:03:54 +01:00
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerLoginServers {
2011-08-11 17:06:42 +02:00
/** @access protected */
var $servers;
2025-02-21 13:53:18 +01:00
/** Set supported servers
* @param array [$description => ["server" => , "driver" => "server|pgsql|sqlite|..."]]
*/
function __construct($servers) {
$this->servers = $servers;
if ($_POST["auth"]) {
$key = $_POST["auth"]["server"];
$_POST["auth"]["driver"] = $this->servers[$key]["driver"];
}
}
2025-02-21 13:53:18 +01:00
function credentials() {
return array($this->servers[SERVER]["server"], $_GET["username"], get_password());
}
2025-02-21 13:53:18 +01:00
function login($login, $password) {
if (!$this->servers[SERVER]) {
return false;
}
}
2025-02-21 13:53:18 +01:00
function loginFormField($name, $heading, $value) {
if ($name == 'driver') {
return '';
} elseif ($name == 'server') {
return $heading . "<select name='auth[server]'>" . optionlist(array_keys($this->servers), SERVER) . "</select>\n";
}
}
2025-02-21 13:53:18 +01:00
}