1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-23 06:32:55 +02:00

Document password functions

This commit is contained in:
Jakub Vrana
2014-02-19 09:27:22 -08:00
parent 822f3f2498
commit 1602db304a
3 changed files with 29 additions and 18 deletions

View File

@@ -108,24 +108,6 @@ function auth_error($exception = null) {
page_footer("auth");
}
function set_password($vendor, $server, $username, $password) {
$_SESSION["pwds"][$vendor][$server][$username] = ($_COOKIE["adminer_key"] && is_string($password)
? array(encrypt_string($password, $_COOKIE["adminer_key"]))
: $password
);
}
function get_password() {
$return = get_session("pwds");
if (is_array($return)) {
$return = ($_COOKIE["adminer_key"]
? decrypt_string($return[0], $_COOKIE["adminer_key"])
: false
);
}
return $return;
}
if (isset($_GET["username"])) {
if (!class_exists("Min_DB")) {
unset($_SESSION["pwds"][DRIVER]);

View File

@@ -249,6 +249,34 @@ function sid() {
return $return;
}
/** Set password to session
* @param string
* @param string
* @param string
* @param string
* @return null
*/
function set_password($vendor, $server, $username, $password) {
$_SESSION["pwds"][$vendor][$server][$username] = ($_COOKIE["adminer_key"] && is_string($password)
? array(encrypt_string($password, $_COOKIE["adminer_key"]))
: $password
);
}
/** Get password from session
* @return string
*/
function get_password() {
$return = get_session("pwds");
if (is_array($return)) {
$return = ($_COOKIE["adminer_key"]
? decrypt_string($return[0], $_COOKIE["adminer_key"])
: false
);
}
return $return;
}
/** Shortcut for $driver->quote($string)
* @param string
* @return string