Created
May 3, 2013 07:51
-
-
Save djekl/5507799 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//ENTER THE RELEVANT INFO BELOW | |
$mysqlDatabaseName ='corporat_ni'; | |
$mysqlUserName ='corporat_user'; | |
$mysqlPassword ='FCx313MY'; | |
$mysqlHostName ='localhost'; | |
$mysqlImportFilename ='mysqldump.sql'; | |
//DISPLAY MYSQL PASSWORD? (TRUE/FALSE) | |
$displayPassword = TRUE; | |
//DONT EDIT BELOW THIS LINE | |
//Export the database and output the status to the page | |
$command='mysql -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' < ' .$mysqlImportFilename; | |
exec($command,$output=array(),$worked); | |
switch($worked) | |
{ | |
case 0: | |
echo 'Import file <b>' .$mysqlImportFilename .'</b> successfully imported to database <b>' .$mysqlDatabaseName .'</b>'; | |
break; | |
case 1: | |
echo 'There was an error during import. Please make sure the import file is saved in the same folder as this script and check your values: | |
<br/> | |
<br/> | |
<table> | |
<tr> | |
<td>MySQL Database Name:</td> | |
<td><b>' .$mysqlDatabaseName .'</b></td> | |
</tr> | |
<tr> | |
<td>MySQL User Name:</td> | |
<td><b>' .$mysqlUserName .'</b></td> | |
</tr> | |
<tr> | |
<td>MySQL Password:</td> | |
<td><b>' . ($displayPassword ? $mysqlPassword : 'HIDDEN') . '</b></td> | |
</tr> | |
<tr> | |
<td>MySQL Host Name:</td> | |
<td><b>' .$mysqlHostName .'</b></td> | |
</tr> | |
<tr> | |
<td>MySQL Import Filename:</td> | |
<td><b>' .$mysqlImportFilename .'</b></td> | |
</tr> | |
</table>'; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment