-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
64 lines (51 loc) · 1.79 KB
/
admin.php
File metadata and controls
64 lines (51 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
function adminer_object() {
class KyseloAdmin extends Adminer {
protected $_kyseloConfig = [];
function __construct($config)
{
$this->_kyseloConfig = $config;
}
function name() {
// custom name in title and heading
return 'Kyselo admin';
}
function permanentLogin($i=false) {
// key used for permanent login
return md5($this->_kyseloConfig['secret']);
}
function credentials() {
// server, username and password for connecting to database
return array('', '', '');
}
function databases($jC=true) {
return array($this->_kyseloConfig['database']);
}
function login($login, $password) {
// validate user submitted credentials
return ($login == 'admin' && md5($password) == $this->_kyseloConfig['adminer_password']);
}
function loginForm() {
?>
<table cellspacing="0">
<tr><th><?php echo lang('Username'); ?><td><input type="hidden" name="auth[driver]" value="server"><input name="auth[username]" id="username" value="<?php echo h($_GET["username"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Password'); ?><td><input type="password" name="auth[password]">
</table>
<input type="hidden" name="auth[driver]" value="sqlite">
<input type="hidden" name="auth[server]">
<input type="hidden" name="auth[db]" value="<?php h($this->_kyseloConfig['database']); ?>">
<script type="text/javascript">
focus(document.getElementById('username'));
</script>
<?php
echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
}
}
if (!file_exists(__DIR__ . '/config.php')) {
die("ERROR: Kyselo not installed.");
}
$config = require 'config.php';
return new KyseloAdmin($config);
}
include "./adminer.php";