auto-logged-in-dumping broken?
Database management in a single PHP file
Brought to you by:
jakubvrana
I use adminer for auto-logged-in-dumping mysql tables in my CMS.
Up to 3.6.3, everthing works fine.
From 3.6.4, the export doesn't start automatically, only export opition page is shown.
Any suggestion what's changed?
My PHP code:
session_start ();define ( 'PREFIX', '../../' );
function adminer_object() {
class AdminerLogin extends Adminer { function credentials() { return array ( DB_HOST, DB_USER, DB_PASS ); } } return new AdminerLogin ();
}
if ( file_exists ( PREFIX . 'libraries/adminer/adminer.php' ) ) {
include PREFIX . 'config/config.php';
include PREFIX . 'apps/core/Datenbank.php';
$db = new Datenbank (); $db->connect ( DB_HOST, DB_NAME, DB_USER, DB_PASS ); $zuSicherndeTabellen = array (); $sql = "SHOW TABLE STATUS LIKE '" . DB_PRAEFIX . "_%';"; $r1 = $db->execQuery ( $sql ); if ( $r1 ) { while ( ($r2 = $db->readRow ( $r1 )) !== false ) { $zuSicherndeTabellen [] = $r2 ['Name']; // tables to dump } } $_GET = array ( "username" => DB_USER, "dump" => 'backup_' . DB_NAME . '_' . date ( "d-m-Y", mktime () ) . '_utf-8', "db" => DB_NAME ); $_POST = array ( "output" => "file", "events" => "1", "routines" => "1", "format" => "sql", "table_style" => "CREATE", "data_style" => "INSERT", "tables" => $zuSicherndeTabellen, "data" => $zuSicherndeTabellen ); Header ( 'Content-type: text/plain; charset=utf-8' ); include PREFIX . 'libraries/adminer/adminer-3.6.4-mysql-de.php';
}
die ();
?>
This is not officially supported. Export uses a CSRF token. I'd suggest extracting just the part of Adminer exporting to data and use it in your project.
You can use this script to export data using Adminer: https://gist.github.com/vrana/8072771
You would need Adminer source codes to use it.