This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
EDT/admin/module/zdb.php
T
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

83 lines
2.6 KiB
PHP

<?php
//-------------------------------
header("Content-type: text/html; charset=utf-8");
if(THIS_IN!="edt_admin")
exit("错误的访问!");
//-------------------------------execute action
$db=_mysql_connect();
$msg_login_user=get_db_msg("select * from ".$table_pre."user where id='".$uid."'");
//权限判断
$priv=return_priv($_m,$msg_login_user["priv"]);
$json_data="{";
if($priv[0]=="n"){
//没有操作权限
$json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
}else{
$tbcate_arr=array("line"=>"折线图","markArea"=>"点状图","bar"=>"柱形图","barmore"=>"多维柱状图","shadow"=>"堆叠条形图","pie"=>"饼图");
$json_data.="\"uid\":".$uid.",";
switch($_a){
case "add":
$str1="";
foreach($tbcate_arr as $key=>$val){
$str1.="{\"no\":\"".$key."\",\"title\":\"".$val."\"},";
}
//
$json_data.="\"tbcate_list\":{\"value\":\"".$tbcate."\",\"op\":[".substr($str1,0,-1)."]},";
break;
case "save_add":
$tmp=get_db_msg("select id from web_zdb_config where title='".$title."' and title2='".$title2."' limit 0,1");
if($tmp["id"]){
$json_data.="\"code\":\"-1\",\"msg\":\"已存在!\",";
}else{
$db->query("insert into web_zdb_config(title,title2,tb_cate) values('".$title."','".$title2."','".$tbcate."')");
$json_data.="\"code\":1,";
}
break;
case "del":
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$q="delete from web_zdb_config where id='".$id[$i]."'";
$db->query($q);
$lid.=$id[$i].", ";
}
$lid=substr($lid,0,-2);
$json_data.="\"code\":1,";
break;
//-------------主界面
default:
//
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
//取得总条数
$tmp=get_db_msg("select count(*) 'num' from web_zdb_config ".$sql_con);
$total_num=$tmp["num"];
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
$count=1;
$str_tmp="";
$sql="select * from web_zdb_config ".$sql_con." order by id limit ".$start.",".$end;
$res=$db->query($sql);
while($msg=$db->fetch_array($res)){
$list=$count+$start;
$str_tmp.="{";
$str_tmp.="\"ct\":\"".$list."\",";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"title\":\"".$msg["title"]."\",";
$str_tmp.="\"title2\":\"".$msg["title2"]."\",";
$str_tmp.="\"tbcate\":\"".$msg["tb_cate"]."(".$tbcate_arr[$msg["tb_cate"]].")\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."],";
break;
}
}
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>