Dumpimporter for http://www.my-Playlist.at


SUBMITTED BY: Guest

DATE: Dec. 29, 2013, 3:17 p.m.

FORMAT: PHP

SIZE: 1.5 kB

HITS: 1022

  1. /**
  2. * Dumpimporter for http://www.my-Playlist.at
  3. * @author Kevin Reinmüller
  4. */
  5. error_reporting(E_ALL);
  6. set_time_limit(0);
  7. # MySQL-Server
  8. $mysqlserver='svr';
  9. # MySQL-Server User
  10. $mysqluser='usr';
  11. # MySQL-Server Password
  12. $mysqlpass='yourpass';
  13. # MySQL-Database
  14. $mysqldatabase='database';
  15. $con=mysql_connect($mysqlserver, $mysqluser, $mysqlpass) or die(error($adminmail));
  16. mysql_select_db($mysqldatabase ,$con) or die(error($adminmail));
  17. // Check connection
  18. if(mysqli_connect_errno()) {
  19. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  20. }
  21. splitSQL("dump.sql");
  22. function splitSQL($file, $delimiter = ';') {
  23. if (is_file($file) === true) {
  24. $file = fopen($file, 'r');
  25. if (is_resource($file) === true) {
  26. $query = array();
  27. while (feof($file) === false) {
  28. $query[] = fgets($file);
  29. if (preg_match('~' . preg_quote($delimiter, '~') . '\s*$~iS', end($query)) === 1) {
  30. $query = trim(implode('', $query));
  31. if (mysql_query($query) === false) {
  32. echo '<h3>ERROR: ' . $query . '</h3>' . "</hr>";
  33. } else {
  34. echo '<p>SUCCESS</p>' . "</hr>";
  35. }
  36. while (ob_get_level() > 0) {
  37. ob_end_flush();
  38. }
  39. flush();
  40. }
  41. if (is_string($query) === true) {
  42. $query = array();
  43. }
  44. }
  45. return fclose($file);
  46. }
  47. }
  48. return false;
  49. }

comments powered by Disqus