Pete Kelly finally fixed all the special characters problems
This commit is contained in:
110
db_readdump.php3
110
db_readdump.php3
@@ -3,67 +3,77 @@
|
||||
|
||||
@set_time_limit(10000);
|
||||
|
||||
|
||||
require("grab_globals.inc.php3");
|
||||
|
||||
|
||||
include("lib.inc.php3");
|
||||
require("lib.inc.php3");
|
||||
|
||||
|
||||
// set up default values
|
||||
$view_bookmark = 0;
|
||||
$sql_bookmark = isset($sql_bookmark) ? $sql_bookmark : "";
|
||||
$sql_query = isset($sql_query) ? $sql_query : "";
|
||||
$sql_file = isset($sql_file) ? $sql_file : "none";
|
||||
|
||||
|
||||
// Bookmark Support
|
||||
|
||||
// Bookmark Support
|
||||
|
||||
if(!empty($id_bookmark)) {
|
||||
switch($action_bookmark) {
|
||||
case 0:
|
||||
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
case 1:
|
||||
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
case 2:
|
||||
$sql_query = delete_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if(!empty($sql_file) && $sql_file != "none" && ereg("^php[0-9A-Za-z_.-]+$", basename($sql_file))) {
|
||||
$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
|
||||
}
|
||||
else if (get_magic_quotes_gpc()) {
|
||||
$sql_query = stripslashes($sql_query);
|
||||
}
|
||||
|
||||
$pieces = split_string($sql_query, ";");
|
||||
|
||||
if (count($pieces) == 1 && !empty($pieces[0]) && $action_bookmark==0) {
|
||||
$sql_query = addslashes(trim($pieces[0]));
|
||||
// Enforce reloading of the left frame when a table has to be created
|
||||
if (eregi('^CREATE TABLE (.+)', $sql_query)) {
|
||||
$reload = "true";
|
||||
switch($action_bookmark) {
|
||||
case 0:
|
||||
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
$view_bookmark = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$sql_query = delete_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
}
|
||||
include ("sql.php3");
|
||||
exit;
|
||||
}
|
||||
|
||||
include("header.inc.php3");
|
||||
for ($i=0; $i<count($pieces); ++$i) {
|
||||
$pieces[$i] = trim($pieces[$i]);
|
||||
if(!empty($pieces[$i])) {
|
||||
$result = mysql_db_query ($db, $pieces[$i]) or mysql_die();
|
||||
// Enforce reloading of the left frame when a table has to be created
|
||||
if (!isset($reload) && eregi('^CREATE TABLE (.+)', $pieces[$i])) {
|
||||
$reload = "true";
|
||||
|
||||
|
||||
if($sql_file != "none") {
|
||||
// do file upload
|
||||
if(!empty($sql_file) && $sql_file != "none" && ereg("^php[0-9A-Za-z_.-]+$", basename($sql_file))) {
|
||||
$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
|
||||
if (get_magic_quotes_runtime() == 1) $sql_query = stripslashes($sql_query);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(get_magic_quotes_gpc() != 0 && get_magic_quotes_runtime() != 0) $sql_query = stripslashes($sql_query);
|
||||
if(get_magic_quotes_gpc() == 1 && get_magic_quotes_runtime() == 0) $sql_query = stripslashes($sql_query);
|
||||
}
|
||||
|
||||
$sql_query = trim($sql_query);
|
||||
$sql_query_cpy = $sql_query; // copy the query, used for display purposes only
|
||||
|
||||
if($sql_query != "") {
|
||||
$sql_query = remove_remarks($sql_query);
|
||||
$pieces = split_sql_file($sql_query,";");
|
||||
|
||||
if (count($pieces) == 1 && !empty($pieces[0]) && $view_bookmark == 0) {
|
||||
$sql_query = addslashes(trim($pieces[0]));
|
||||
if (eregi('^CREATE TABLE (.+)', $sql_query)) $reload = "true";
|
||||
include ("sql.php3");
|
||||
exit;
|
||||
}
|
||||
|
||||
include("header.inc.php3");
|
||||
if(mysql_select_db($db)) {
|
||||
// run multiple queries
|
||||
for ($i=0; $i<count($pieces); $i++) {
|
||||
$sql = trim($pieces[$i]);
|
||||
if(!empty($sql) and $sql[0] != "#") $result = mysql_query($sql) or mysql_die2($sql);
|
||||
if (!isset($reload) && eregi('^CREATE TABLE (.+)', $pieces[$i])) $reload = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$sql_query = stripslashes($sql_query);
|
||||
$sql_query = $sql_query;
|
||||
// copy the original query back for display purposes
|
||||
$sql_query = $sql_query_cpy;
|
||||
$message = $strSuccess;
|
||||
|
||||
include("db_details.php3");
|
||||
|
||||
?>
|
||||
?>
|
Reference in New Issue
Block a user