Cannot configure password less sqlite access #1244
joker197cinque
started this conversation in
General
Replies: 1 comment
-
<?php
// 访问此脚本,而不是adminer.php
function adminer_object() {
$password = '123456'; // 登录的时候输入密码123456,密码可自定义
class AdminerLoginPasswordLess extends Adminer\Plugin {
protected $password_hash;
/** Set allowed password
* @param string $password_hash result of password_hash()
*/
function __construct($password_hash) {
$this->password_hash = $password_hash;
}
function credentials() {
$password = Adminer\get_password();
return array(Adminer\SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
}
function login($login, $password) {
if ($password != "") {
return true;
}
}
protected $translations = array(
'cs' => array('' => 'Povolí přihlášení bez hesla'),
'de' => array('' => 'Ermöglicht die Anmeldung ohne Passwort'),
'pl' => array('' => 'Włącz logowanie bez hasła'),
'ro' => array('' => 'Activați autentificarea fără parolă'),
'ja' => array('' => 'パスワードなしのログインを許可'),
);
}
return new Adminer\Plugins(array(
new AdminerLoginPasswordLess(password_hash($password, PASSWORD_DEFAULT)),
));
}
include "./adminer.php"; // 注意路径
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I would like to use adminer with sqlite using login-password-less.php plugin but I really can't.
Can please someone guide me step by step ?
I read online example:
function adminer_object() {
include_once "../plugins/login-password-less.php";
return new Adminer\Plugins(array(
// TODO: inline the result of password_hash() so that the password is not visible in source codes
new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)),
));
}
include "./index.php";
but I don't really know where to put this code. Also, I need also a plugin.php file to make login-password-less.php work ?
I tried to ask Gemini and she told me to do this:
function adminer_object() {
include_once "./plugin.php";
include_once "./login-password-less.php";
return new AdminerPlugin([
new AdminerLoginPasswordLess(password_hash("", PASSWORD_DEFAULT)),
]);
}
include "./adminer.php";
but it does not work.
Please help
Thanks
Beta Was this translation helpful? Give feedback.
All reactions