merge with db_dump.php
This commit is contained in:
@@ -17,8 +17,7 @@ else
|
|||||||
{
|
{
|
||||||
include("./lib.inc.php3");
|
include("./lib.inc.php3");
|
||||||
$ext = "sql";
|
$ext = "sql";
|
||||||
if($what == "csv")
|
if($what == "csv") $ext = "csv";
|
||||||
$ext = "csv";
|
|
||||||
header("Content-disposition: filename=$table.$ext");
|
header("Content-disposition: filename=$table.$ext");
|
||||||
header("Content-type: application/octetstream");
|
header("Content-type: application/octetstream");
|
||||||
header("Pragma: no-cache");
|
header("Pragma: no-cache");
|
||||||
@@ -34,8 +33,6 @@ else
|
|||||||
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
|
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
|
||||||
}
|
}
|
||||||
$client = $HTTP_USER_AGENT;
|
$client = $HTTP_USER_AGENT;
|
||||||
//$client = getenv("HTTP_USER_AGENT");
|
|
||||||
|
|
||||||
|
|
||||||
if(ereg('[^(]*\((.*)\)[^)]*',$client,$regs))
|
if(ereg('[^(]*\((.*)\)[^)]*',$client,$regs))
|
||||||
{
|
{
|
||||||
@@ -66,46 +63,77 @@ function my_csvhandler($sql_insert)
|
|||||||
echo $sql_insert . $add_character . $crlf;
|
echo $sql_insert . $add_character . $crlf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($table)){
|
||||||
|
$tables = mysql_list_tables($db);
|
||||||
|
$num_tables = @mysql_numrows($tables);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$num_tables=1;
|
||||||
|
$single=true;
|
||||||
|
}
|
||||||
|
if($num_tables == 0)
|
||||||
|
{
|
||||||
|
echo $strNoTablesFound;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if($what != "csv")
|
if($what != "csv")
|
||||||
{
|
{
|
||||||
print "# phpMyAdmin MySQL-Dump$crlf";
|
echo "# phpMyAdmin MySQL-Dump$crlf";
|
||||||
print "# http://phpmyadmin.sourceforge.net/$crlf";
|
echo "# http://phpwizard.net/phpMyAdmin/$crlf";
|
||||||
print "#$crlf";
|
echo "# http://phpmyadmin.sourceforge.net/ (unofficial)$crlf";
|
||||||
print "# $strHost: ".$cfgServer['host']."$crlf";
|
echo "#$crlf";
|
||||||
print "# $strGenTime: ".date("F j, Y, g:i a")."$crlf";
|
echo "# $strHost: ".$cfgServer['host']."$crlf";
|
||||||
print "# $strServerVersion: ".MYSQL_MAJOR_VERSION.".".MYSQL_MINOR_VERSION."$crlf";
|
echo "# $strGenTime: ".date("F j, Y, g:i a")."$crlf";
|
||||||
if(!empty($cfgServer['port']))
|
echo "# $strServerVersion: ".MYSQL_MAJOR_VERSION.".".MYSQL_MINOR_VERSION."$crlf";
|
||||||
print ":" . $cfgServer['port'];
|
if(!empty($cfgServer['port'])) echo ":" . $cfgServer['port'];
|
||||||
print "# $strDatabase: $db$crlf";
|
echo "# $strDatabase: $db$crlf";
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
if (isset($table_select)) {
|
||||||
|
$tmp_select=implode($table_select,"|");
|
||||||
|
$tmp_select="|".$tmp_select."|";
|
||||||
|
}
|
||||||
|
while($i < $num_tables)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!isset($single)) $table = mysql_tablename($tables, $i);
|
||||||
|
if(isset($tmp_select) && is_int(strpos($tmp_select,"|".$table."|"))==false) $i++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if($what != "dataonly")
|
if($what != "dataonly")
|
||||||
{
|
{
|
||||||
print "# --------------------------------------------------------$crlf";
|
echo "# --------------------------------------------------------$crlf";
|
||||||
print "$crlf#$crlf";
|
echo "$crlf#$crlf";
|
||||||
print "# $strTableStructure '$table'$crlf";
|
echo "# $strTableStructure '$table'$crlf";
|
||||||
print "#$crlf$crlf";
|
echo "#$crlf$crlf";
|
||||||
|
|
||||||
print get_table_def($db, $table, $crlf).";$crlf";
|
echo get_table_def($db, $table, $crlf).";$crlf";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($what == "data") || ($what == "dataonly"))
|
if(($what == "data") || ($what == "dataonly"))
|
||||||
{
|
{
|
||||||
print "$crlf#$crlf";
|
echo "$crlf#$crlf";
|
||||||
print "# $strDumpingData '$table'$crlf";
|
echo "# $strDumpingData '$table'$crlf";
|
||||||
print "#$crlf$crlf";
|
echo "#$crlf$crlf";
|
||||||
|
|
||||||
get_table_content($db, $table, "my_handler");
|
get_table_content($db, $table, "my_handler");
|
||||||
}
|
}
|
||||||
print "$crlf"; // Don't remove, it makes easier to select & copy from browser - staybyte
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "$crlf"; // Don't remove, it makes easier to select & copy from browser - staybyte
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // $what != "csv"
|
{ // $what != "csv"
|
||||||
get_table_csv($db, $table, $separator, "my_csvhandler");
|
get_table_csv($db, $table, $separator, "my_csvhandler");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(empty($asfile))
|
if(empty($asfile))
|
||||||
{
|
{
|
||||||
print "</pre></div>\n";
|
echo "</pre></div>\n";
|
||||||
include("./footer.inc.php3");
|
include("./footer.inc.php3");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user