/**
* Dumpimporter for http://www.my-Playlist.at
* @author Kevin Reinmüller
*/
error_reporting(E_ALL);
set_time_limit(0);
# MySQL-Server
$mysqlserver='svr';
# MySQL-Server User
$mysqluser='usr';
# MySQL-Server Password
$mysqlpass='yourpass';
# MySQL-Database
$mysqldatabase='database';
$con=mysql_connect($mysqlserver, $mysqluser, $mysqlpass) or die(error($adminmail));
mysql_select_db($mysqldatabase ,$con) or die(error($adminmail));
// Check connection
if(mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
splitSQL("dump.sql");
function splitSQL($file, $delimiter = ';') {
if (is_file($file) === true) {
$file = fopen($file, 'r');
if (is_resource($file) === true) {
$query = array();
while (feof($file) === false) {
$query[] = fgets($file);
if (preg_match('~' . preg_quote($delimiter, '~') . '\s*$~iS', end($query)) === 1) {
$query = trim(implode('', $query));
if (mysql_query($query) === false) {
echo '<h3>ERROR: ' . $query . '</h3>' . "</hr>";
} else {
echo '<p>SUCCESS</p>' . "</hr>";
}
while (ob_get_level() > 0) {
ob_end_flush();
}
flush();
}
if (is_string($query) === true) {
$query = array();
}
}
return fclose($file);
}
}
return false;
}