chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
//-------------------------------导出数据
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
if(THIS_IN!="edt_admin")
|
||||
exit("错误的访问!");
|
||||
//-----------------------------------------> function
|
||||
function sqldumptable($table,$structure_only='',$merged='') {
|
||||
global $db;
|
||||
$partten="/_view_/i";
|
||||
$offset=300;
|
||||
$tabledump='';
|
||||
if($merged!="y"){
|
||||
if(!preg_match($partten,$table)){
|
||||
$tabledump="DROP TABLE IF EXISTS $table;\n";
|
||||
}else{
|
||||
$tabledump="DROP VIEW IF EXISTS $table;\n";
|
||||
}
|
||||
$createtable=$db->query("SHOW CREATE TABLE $table");
|
||||
$create=$db->fetch_row($createtable);
|
||||
$query=$db->query("SHOW TABLE STATUS LIKE '$table'");
|
||||
$tablestatus=$db->fetch_array($query);
|
||||
$tabledump.=$create[1].";\n\n";
|
||||
//if($structure_only=="y")
|
||||
//$tabledump=preg_replace("/AUTO_INCREMENT=(\D|*)/","",$tabledump);
|
||||
}
|
||||
if($structure_only!="y" && !preg_match($partten,$table)){
|
||||
//导出数据
|
||||
$rows=$db->query("SELECT * FROM $table");
|
||||
$numfields=$db->num_fields($rows);
|
||||
$numrows=$db->num_rows($rows);
|
||||
while($row=$db->fetch_row($rows)) {
|
||||
$comma='';
|
||||
$tabledump .= "INSERT INTO $table VALUES(";
|
||||
for($i=0; $i < $numfields; $i++) {
|
||||
if($merged=="y" && $i==0)
|
||||
$tabledump .= $comma."''";
|
||||
else
|
||||
$tabledump .= $comma."'".mysql_escape_string($row[$i])."'";
|
||||
$comma=",";
|
||||
}
|
||||
$tabledump .= ");\n";
|
||||
}
|
||||
$tabledump .= "\n";
|
||||
}
|
||||
return $tabledump;
|
||||
}
|
||||
$msg_login_user=get_db_msg("select * from ".$table_pre."user where id='".$uid."'");
|
||||
|
||||
//---------priv
|
||||
$json_data="{";
|
||||
$priv=return_priv($_m,$msg_login_user["priv"]);
|
||||
if($priv[0]=="n"){
|
||||
//没有操作权限
|
||||
$json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
|
||||
}else{
|
||||
//有权限
|
||||
switch($_a){
|
||||
case "export_do":
|
||||
$table_num=count($tables);
|
||||
if($table_num==0){
|
||||
$json_data.="\"code\":\"0\"}";
|
||||
alert_and_back("请选择数据库。");
|
||||
}else{
|
||||
$sqldump="";
|
||||
$sqldump="# ".$msg_login_user["username"]."! Mysql Data Dump\n".
|
||||
"# Time: ".date("Y-m-d H:i:s")."\n".
|
||||
"# Database: ".$dbname."\n".
|
||||
"# Table Prefix: ".$table_pre."\n".
|
||||
"# --------------------------------------------------------\n\n\n".$sqldump;
|
||||
// for($i=0;$i<$table_num;$i++){
|
||||
// $tname=$tables[$i];
|
||||
// $log_tables.=$tname.", ";
|
||||
// $sqldump.=sqldumptable($tname,$structure_only,$merged);
|
||||
// }
|
||||
foreach($tables as $value){
|
||||
$tname=$value;
|
||||
$log_tables.=$tname.", ";
|
||||
$sqldump.=sqldumptable($tname,$structure_only,$merged);
|
||||
}
|
||||
$log_tables=substr($log_tables,0,-2);
|
||||
if($structure_only=="y")
|
||||
$log_tables.="(仅结构)";
|
||||
$filename="mysql_".$dbname."_".date("YmdHis").".sql";
|
||||
$mime_type=ereg('MSIE ([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'])||ereg('Opera(/| )([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'])?"application/octetstream":"application/octet-stream";
|
||||
header("Content-Type:".$mime_type);
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
echo $sqldump;
|
||||
$uid=$login_uid;
|
||||
//$json_data.="\"code\":\"1\"}";
|
||||
$json_data="";
|
||||
set_log("数据导出",$log_tables);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
$tables=mysql_list_tables($dbname);
|
||||
$table_num=@mysql_numrows($tables);
|
||||
for($i=0;$i<$table_num;$i++){
|
||||
$tname=mysql_tablename($tables,$i);
|
||||
$partten="/_view_/i";
|
||||
if(!preg_match($partten,$tname) && $tname!=$table_pre."pic"){
|
||||
//if($tname==$table_pre."log")
|
||||
//$cb.="<input type=checkbox name=tables[] id=\"t_".$i."\" value=\"".$tname."\">".$tname."<br>";
|
||||
//else
|
||||
if(substr($tname,0,strlen($table_pre))==$table_pre)
|
||||
$cb.="{\"k\":\"".$i."\",\"t\":\"".$tname."\"},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"col\":[".substr($cb,0,-1)."],";
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo $json_data;
|
||||
?>
|
||||
Reference in New Issue
Block a user