用这个程序可以实现简单的数据导出(生成的脚本可直接在phpmyadmin执行)。进一步的功能还可以慢慢扩展。当然不要用来盗用别人机密的冬冬了。
其中解析的数据类型还不全,只是集中简单的常用类型。如果那位仁兄,发现了其他不适用的类型,请告诉我mailto:woaini4651@yahoo.com.cn。

index.php
|
cmd.php
if(isset($_POST['backupstart']))
{
$hostname = trim($_POST['hostname']);
$database = trim($_POST['database']);
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$backtype = $_POST['backup_type'];
$gz = $_POST['gzipcompress'];
$link = @mysql_pconnect($hostname, $username, $password);
if(!$link)
{ //连接数据库
echo "数据库打开出错!";
exit();
}//end if
$table_list = get_table_list($link,$database);
if($table_name===false)
{ //检索数据库的表
echo "数据库打开出错!!";
exit();
}//end if
//echo "
";输出
//print_r($table_list);
$table_code = "";
while(list($key,$table_name)=each($table_list))
{ //执行对每一个表的数据返回
if($backtype!="data")
{ //备份结构
$table_code .= get_table_code($link,$database,$table_name);
}//end if
if($backtype!="structure")
{ //备份数据
$table_code .= get_table_data($link,$database,$table_name);
}//end if
}//end while
//echo $table_code;
if($gz==0)
{ //
$filename = $database.".sql";
$handle = fopen($filename, "a+");
$temp = fwrite($handle, $table_code);
echo $temp;
fclose($handle);
//header("location:",$filename);
echo "