Example #1
0
if (isset($_POST["import"])) {
    if (isset($_FILES["importFile"]["tmp_name"]) && strlen($_FILES["importFile"]["tmp_name"]) > 0) {
        $file = $_FILES["importFile"]["tmp_name"];
        // set name based on whether existing or new values have been defined.
        // favour new to avoid nuking existing dbs where possible
        if (isset($_POST["db-existing"])) {
            $dbName = $_POST["db-existing"];
        }
        if (isset($_POST["db-new"])) {
            if (strlen($_POST["db-new"])) {
                $dbName = $_POST["db-new"];
            }
        }
        // if we've got a file and a database name, import it
        if (isset($file) && isset($dbName)) {
            if (!($restoreResult = importDB($connection, $dbName, $file, $dbs))) {
                $restoreResult = true;
            }
        } else {
            $restoreResult = "Can't use specified filename/database.";
        }
    }
}
// disconnect from db server
mysql_close($connection);
?>



<!DOCTYPE html>
<html>
Example #2
0
     packageDelete($option);
     break;
 case 'deletepackage':
     pakageDeleteProcess();
     break;
 case 'cancel':
     cancelMolecule();
     break;
 case 'about':
     aboutComponent();
     break;
 case 'exportdb':
     exportDB();
     break;
 case 'importdb':
     importDB($option);
     break;
 case 'importdbprocess':
     importDBProcess();
     break;
 case 'listoffiles':
     listOfFiles($option);
     break;
 case 'viewlog':
     showLogFile();
     break;
 case 'delfiles':
     delFiles($fid);
     break;
 default:
     showMolecules($option);
Example #3
0
        echo "\r\n            <strong>\r\n              <font color=\"red\">\r\n              Fatal error captured:\r\n              </font>\r\n            </strong>\r\n        ";
        echo "<pre>";
        print_r($error);
        echo "</pre>";
    }
}
require_once 'migrationFunctions.php';
if (!isset($_POST['action'])) {
    showMenu();
} else {
    if (preg_match("/Export all databases/", $_POST['action'])) {
        $myMigration = new migration();
        $myMigration->exportAllDBs();
    } else {
        if (preg_match("/Import Mangesh/", $_POST['action'])) {
            importDB();
        }
    }
}
function showMenu()
{
    ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>MySQL Export by Mangesh Sangapu</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
$file_tmp_name = $_FILES['userfile']['tmp_name'];
// ECHO $file_tmp_name;
// ECHO "<br/>";
$file_size = $_FILES['userfile']['size'];
// ECHO $file_size;
//ECHO "<br/>";
$file_type = $_FILES['userfile']['type'];
// ECHO $file_type;
//ECHO "<br/>";
//if file is empty
if ($file_size <= 0) {
    die('<center>Can not upload empty file</canter>');
}
//if file is not SQL type
if (!($file_type == "application/octet-stream")) {
    die('<center>This is not Database file</center>');
}
//checking that file is uploaded via http poet method
if (is_uploaded_file($file_tmp_name)) {
    //copy that uploaded file to our main folder
    if (!move_uploaded_file($file_tmp_name, $file_name)) {
        die("<center>cannot copy file {$file_name}</center>");
    }
} else {
    //die("Possible file upload attack:");
}
//echo $filename = $_POST['userfile'];
importDB($file_name, "localhost", "kashifdb", "123456", "composeup");
unlink($file_name);
$_SESSION['check'] = "ImportSeccess";
header('Location: ../edit.php#/');
Example #5
0
         }
     }
     // display the tables on screen so we can see they were dumped
     echo "<h2>Showing tables after database export and table dump</h2>";
     if ($tables = getTableList($connection, $config["db"]["name"])) {
         foreach ($tables as $id => $table) {
             printTable($connection, $table);
         }
     } else {
         echo "<br><br>No tables found.<br><br>";
     }
     //
     // import database from file and show it on screen
     //
     echo "<h2>Showing tables after file import</h2>";
     $importResult = importDB($connection, $config["db"]["name"], $config["db"]["backupFile"]);
     // if there's an error, show it
     if ($importResult) {
         echo $importResult;
     }
     // display the tables on screen so we can see they were dumped
     if ($tables = getTableList($connection, $config["db"]["name"])) {
         foreach ($tables as $id => $table) {
             printTable($connection, $table);
         }
     } else {
         echo "<br><br>No tables found.<br><br>";
     }
 } else {
     echo "Error selecting database: " . mysql_error();
 }