mysql 在线备份 导入_index.php 源代码在线查看 - MYSQL全系列自导入数据库备份程序 v1.0 支持MYSQL4.1 资源下载 虫虫电子下载站...

//配置部分: //注意,如果您没有在后面的注释的地方加上管理员身份验证程序,//请不要配置正确的数据库用户名和密码!//采用默认配置运行,程序会给出表单你填写的。$db_host="localhost"; //数据库服务器$db_username="root"; //数据库用户名$db_password=""; //数据库密码$db_dbname=""; //选择的数据库//兼容低版本PHPfunction requestValues(){return ' if(!isset($_POST)){ $_POST = $HTTP_POST_VARS; $_GET = $HTTP_GET_VARS; $_SERVER = $HTTP_SERVER_VARS;} ';}eval(requestValues());$_POST["frametopheight"]=90; //FrameTop 的高define("VERSION","4.0"); //版本error_reporting(1);@set_time_limit(0);function num_bitunit($num){ $bitunit=array(' B',' KB',' MB',' GB'); for($key=0;$keyif($num>=pow(2,10*$key)-1){ //1023B 会显示为 1KB $num_bitunit_str=(ceil($num/pow(2,10*$key)*100)/100)." $bitunit[$key]";} } return $num_bitunit_str;}//frame 分开标题function frameset_html(){global $_POST;return "if(!\$_GET[framename]){echo \" 自导入数据库备份程序 — Powerd By faisun Edit by HaierSpI \";exit;}";}function postvars_function(){return 'function fsql_StrCode($string,$action="ENCODE"){global $_SERVER;if($string=="") return "";if($action=="ENCODE") $md5code=substr(md5($string),8,10);else{$md5code=substr($string,-10); $string=substr($string,0,strlen($string)-10); }$key = md5($md5code.$_SERVER["HTTP_USER_AGENT"].filemtime($_SERVER["SCRIPT_FILENAME"]));$string = ($action=="ENCODE"?$string:base64_decode($string));$len = strlen($key);$code = "";for($i=0; $i$k = $i%$len;$code .= $string[$i]^$key[$k];}$code = ($action == "DECODE" ? (substr(md5($code),8,10)==$md5code?$code:NULL) : base64_encode($code)."$md5code");return $code;}if($_POST[faisunsql_postvars]){if($faisunsql_postvars=unserialize(fsql_StrCode($_POST[faisunsql_postvars],"DECODE"))){foreach($faisunsql_postvars as $key=>$value){if(!isset($_POST[$key])) $_POST[$key] = $value;}}else{ die("alert(\'由于文档更改,提交信息已丢失,需要重新开始.\');"); }unset($_POST[faisunsql_postvars],$faisunsql_postvars,$key,$value);}';}eval(frameset_html().postvars_function());if($_POST["totalsize"]){$totalsize_chunk=num_bitunit($_POST["totalsize"]);}//css 样式定义function csssetting(){ return "body, td, input, a{color:#985b00;font-family: '宋体';font-size: 9pt;}body, td, a{line-height:180%; }.tabletitle{color:#FFFFFF;background-color:#FF6600;}.tabledata{background-color:#FFEECC;}.tabledata_on{background-color:#FFFFCC;}input, .borderdiv {border:1px inset;}-->";}//各页相同的页面头function fheader(){global $_POST;$str = fsql_StrCode(serialize($_POST),"ENCODE");echo " 自导入数据库备份程序 — Powerd By faisun Edit by HaierSpI".csssetting()."document.doshowmywin=1;";}function showmywin_script(){global $_POST;return "function showmywin(){if(!document.doshowmywin) return;if(top.myframeset&&this.window.name=='mainFrame1'){top.myframeset.rows='$_POST[frametopheight],*,0';}if(top.myframeset&&this.window.name=='mainFrame2'){top.myframeset.rows='$_POST[frametopheight],0,*';}}document.body.οnlοad=showmywin;";}//各页相同的页面尾function ffooter(){echo "AD位 PHP主力技术论坛:PHPSO.COM QQ群:6116767FaisunSQL自导入数据库备份程序 V".VERSION." HaierSpI 修改版".showmywin_script()."";}//开始说明表格function tabletext($ttext="",$twidth=400){return "$ttext\r\n";}//开始一个表格function tablestart($ttitle="",$twidth=400){return " $ttitle ";}//插入数据到表格function tabledata($data,$widths=""){$pdata=explode("|",$data);$pwidths=explode("|",$widths);$str="\r\n";for(@reset($pdata);@list($key,$val)=@each($pdata);){$str.="\t$pdata[$key]\r\n";}$str.="\r\n";return $str;}//结束一个表格function tableend(){return "\r\n";}//按钮样式function fbutton($type="submit",$name="Submit",$value="确定",$script="",$return=0){$str=" ";if($return) return $str;else echo $str;}//topFrameif($_GET["action"]=="topframe"&&$_GET["framename"]=="topframe"){fheader();echo "";echo "";exit;}//说明文档if($_GET["action"]=="readme"){fheader();echo tablestart("说明文档");echo tabledata(implode('',file("faisunsql_files/readme.htm")));echo tableend();ffooter();exit;}/* 如果您在开头配置部分填写了正确的配置,您可以在这里加上管理员身份验证,并把下面声明常量的语句用在代码中:define("IS_ADMIN","yes"); //用于检验是否加了管理员身份验证代码。*/if(!isset($_POST[dosubmit])){$_POST["db_host"]=$db_host;$_POST["db_username"]=$db_username;$_POST["db_password"]=$db_password;$_POST["db_dbname"]=$db_dbname;$_POST["db_code"]=$db_code;}// 配置表单if(!@mysql_connect($_POST[db_host],$_POST[db_username],$_POST[db_password])||!@mysql_select_db($_POST[db_dbname])){fheader();if(isset($_POST['finByte']) and isset($_POST['db_dbname'])){echo "连接数据库超时,请刷新重试.10秒后将自动重试.也可能是配置不对,请检查您的配置.";echo "document.doshowmywin=0;retryTime=10;function timeescape(){if(!retryTime) return;timeescapepls.innerHTML=retryTime--;}setInterval('timeescape()',1000);function submitme(){for(i=myform.elements.length-1;i>=0;i--){if(myform.elements[i].name==\"action\")break;}myform.elements[i].value=\"databackup\";myform.submit();}setTimeout('submitme()',retryTime*1000);";}else if(isset($_POST[dosubmit])){echo "alert('连接数据库错误,请检查您的配置.');";}echo tabletext("输入正确的配置以连接数据库。 如果无法连接数据库,请联系您的主机管理员以获得正确配置值。");echo tablestart("请检查您的配置");echo tabledata("服务器主机:|");echo tabledata("要导出的数据库:|");echo tabledata("数据库用户名:|");echo tabledata("数据库密码:|");echo tabledata("数据库编码(MYSQL低于4.1本项无效):|");echo tableend();fbutton('submit','dosubmit','连接');fbutton('reset','doreset','重置');ffooter();//新版本检测echo "";exit;}//mysql_query("SET NAMES gb2312;");if (mysql_get_server_info()> '4.1'){global $db_codeset,$_POST;mysql_query("SET NAMES `GBK`");$db_codeset = $_POST["db_code"];}if(!defined("IS_ADMIN") and !isset($_POST['db_dbname'])){die("您在程序开头部分填写了正确的配置,但没有加上任何管理员身份验证代码。为了安全,请不要配置正确的数据库用户名和密码!");}//选择要备份的数据表if (!isset($_POST['action'])){$currow=mysql_fetch_array(mysql_query("select version() as v"));$_POST['mysql_version']=$currow['v'];fheader();echo tabletext("以下列出的是该数据库中所有的数据表。默认情况下全部导出,您也可以选择只导出其中一部分表。",500);echo tablestart("请选择要备份的数据表   (当前数据库版本: $_POST[mysql_version])",500);echo tabledata("[反选]|表名|注释|记录数|大小","10%|30%|30%|17%|23%");$query=mysql_query("SHOW TABLE STATUS");while ($currow=mysql_fetch_array($query)){echo tabledata("|$currow[Name]|$currow[Comment]|$currow[Rows]|".num_bitunit($currow[Data_length]+$currow[Index_length])."");}echo tabledata("[反选]|目前选择表的总大小:| | |");echo tableend();echo " function selrev() {with(myform) {for(i=0;ithiselm = elements[i];if(thiselm.name.match(/fsqltable\[\w+\]/))thiselm.checked = !thiselm.checked;}}getsize(); } function num_bitunit(num){ var bitunit=new Array(' B',' KB',' MB',' GB'); for(key=0;key if(num>=Math.pow(2,10*key)-1){ //1023B 会显示为 1KB num_bitunit_str=(Math.ceil(num/Math.pow(2,10*key)*100)/100)+' '+bitunit[key]; } } return num_bitunit_str; } function getsize(){var ts=0;with(document.myform) {for(i=0;ithiselm = elements[i];if(thiselm.name.match(/fsqltable\[\w+\]/))ts += parseInt(thiselm.value);}totalsizetxt.innerHTML=num_bitunit(ts);} } getsize();-->";

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值