Skip to content

Instantly share code, notes, and snippets.

@vrana
Last active April 28, 2017 03:45
Show Gist options
  • Save vrana/8072771 to your computer and use it in GitHub Desktop.
Save vrana/8072771 to your computer and use it in GitHub Desktop.
<?php
define('DUMP_FILENAME', 'dump.sql');
define('SERVER', 'localhost');
define('USERNAME', 'ODBC');
define('PASSWORD', '');
define('DB', 'software');
define('ADMINER_ROOT', 'adminer/');
function adminer_object() {
class AdminerDump extends Adminer {
function credentials() {
return array(SERVER, USERNAME, PASSWORD);
}
}
return new AdminerDump;
}
function save_output($buffer) {
file_put_contents(DUMP_FILENAME, $buffer, FILE_APPEND);
}
error_reporting(E_ALL & ~E_NOTICE);
include ADMINER_ROOT . "adminer/include/functions.inc.php";
include ADMINER_ROOT . "adminer/include/lang.inc.php";
include ADMINER_ROOT . "adminer/include/pdo.inc.php";
include ADMINER_ROOT . "adminer/include/driver.inc.php";
include ADMINER_ROOT . "adminer/drivers/mysql.inc.php";
include ADMINER_ROOT . "adminer/include/adminer.inc.php";
include ADMINER_ROOT . "adminer/include/editing.inc.php";
$connection = connect();
$connection->select_db(DB);
$tables = tables_list();
$_POST = array(
'output' => 'text',
'format' => 'sql',
'table_style' => 'CREATE',
'data_style' => 'INSERT',
'tables' => array_keys($tables),
'data' => array_keys($tables),
);
file_put_contents(DUMP_FILENAME, '');
ob_start('save_output', 1e6);
include ADMINER_ROOT . "adminer/dump.inc.php";
@cyberzilla
Copy link

why just not include only adminer.php?

if can't, where can i get the adminer directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment