Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 52 lines (46 sloc) 1.697 kB
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
1 <?php
2
3 /** Display constant list of servers in login form
091a4d0 @vrana Link to documentation
authored
4 * @link http://www.adminer.org/plugins/#use
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
5 * @author Jakub Vrana, http://www.vrana.cz/
6 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
8 */
9 class AdminerLoginServers {
7578342 @vrana Comment
authored
10 /** @access protected */
11 var $servers, $driver;
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
12
13 /** Set supported servers
14 * @param array array($domain) or array($domain => $description) or array($category => array())
56a1bdd @vrana Support for other drivers
authored
15 * @param string
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
16 */
56a1bdd @vrana Support for other drivers
authored
17 function AdminerLoginServers($servers, $driver = "server") {
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
18 $this->servers = $servers;
56a1bdd @vrana Support for other drivers
authored
19 $this->driver = $driver;
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
20 }
21
22 function login($login, $password) {
23 // check if server is allowed
24 foreach ($this->servers as $key => $val) {
25 $servers = $val;
26 if (!is_array($val)) {
27 $servers = array($key => $val);
28 }
29 foreach ($servers as $k => $v) {
30 if ((is_string($k) ? $k : $v) == SERVER) {
31 return;
32 }
33 }
34 }
35 return false;
36 }
37
38 function loginForm() {
39 ?>
40 <table cellspacing="0">
f595f93 @vrana Use namespace in login form
authored
41 <tr><th><?php echo lang('Server'); ?><td><input type="hidden" name="auth[driver]" value="<?php echo $this->driver; ?>"><select name="auth[server]"><?php echo optionlist($this->servers, SERVER); ?></select>
42 <tr><th><?php echo lang('Username'); ?><td><input id="username" name="auth[username]" value="<?php echo h($_GET["username"]); ?>">
43 <tr><th><?php echo lang('Password'); ?><td><input type="password" name="auth[password]">
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
44 </table>
45 <p><input type="submit" value="<?php echo lang('Login'); ?>">
46 <?php
f595f93 @vrana Use namespace in login form
authored
47 echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
1804f71 @vrana New plugin: Display constant list of servers in login form
authored
48 return true;
49 }
50
51 }
Something went wrong with that request. Please try again.