Skip to content

Instantly share code, notes, and snippets.

@alexantr
Created January 16, 2021 18:48
Show Gist options
  • Save alexantr/0ce820ace587ccab7ca8c2c952be24ed to your computer and use it in GitHub Desktop.
Save alexantr/0ce820ace587ccab7ca8c2c952be24ed to your computer and use it in GitHub Desktop.
Adminer with password saving
<?php
// download latest from https://www.adminer.org/latest-mysql-en.php
$files = scandir(__DIR__, SCANDIR_SORT_DESCENDING);
foreach ($files as $file) {
if ($file != '.' && $file != '..' && is_file(__DIR__ . '/' . $file) && strpos($file, 'adminer-') === 0 && substr($file, -4) === '.php') {
$f = str_replace('-mysql', '', $file);
if (is_file(__DIR__ . '/' . $f)) {
require __DIR__ . '/' . $f;
break;
}
require __DIR__ . '/' . $file;
break;
}
}
function adminer_object()
{
class AdminerSoftware extends Adminer
{
function permanentLogin($g = false)
{
// key used for permanent login
return md5(__FILE__);
}
/*public function dumpFilename($identifier)
{
return friendly_url(($identifier != '' ? $identifier : (SERVER != '' ? SERVER : 'localhost')) . '-' . date('Ymd-His'));
}*/
}
return new AdminerSoftware;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment