Skip to content
Snippets Groups Projects
wiederherstellen.php 912 B
Newer Older
<?php

if (is_writable('backup/' .$_POST['datei'])) {
	$fp = file_get_contents('backup/' .$_POST['datei']);
	$fp = entsch($fp);
	file_put_contents('backup/' .$_POST['datei'], $fp);
}

$qres = db_query("SHOW TABLES") or die(mysqli_error($sql_open));
while (list($tabelle) = mysqli_fetch_row($qres)){
	db_query("DROP TABLE IF EXISTS ". $tabelle);
}
// DB_PASS on cli ... happy person watching process list
$command='mysql -h' .DB_HOST .' -u' .DB_USER .' -p' .DB_PASS .' ' . DB_BASE .' < backup/' .$_POST['datei'];
exec($command,$output=array(),$worked);
$meldung = meldung(0,'Die Daten aus der Datei <b>' .$_POST['datei'] .'</b> wurden erfolgreich eingespielt in der Datenbank <b>' .$_POST['datei'] .'</b>');


if (is_writable('backup/' .$_POST['datei'])) {
	$fp = file_get_contents('backup/' .$_POST['datei']);
	$fp = versch($fp);
	file_put_contents('backup/' .$_POST['datei'], $fp);
}