7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
83 lines
2.6 KiB
PHP
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;
|
|
?>
|