7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
116 lines
3.9 KiB
PHP
116 lines
3.9 KiB
PHP
<?php
|
|
//-------------------------------日志管理
|
|
header("Content-type: text/html; charset=utf-8");
|
|
if(THIS_IN!="edt_admin")
|
|
exit("错误的访问!");
|
|
$msg_login_user=get_db_msg("select * from ".$table_pre."user where id='".$uid."'");
|
|
//---------priv
|
|
$priv=return_priv($_m,$msg_login_user["priv"]);
|
|
$json_data="{";
|
|
if($priv[0]=="n"){
|
|
//没有操作权限
|
|
$json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
|
|
}else{
|
|
$json_data.="\"uid\":".$uid.",";
|
|
//有权限
|
|
switch($_a){
|
|
case "view":
|
|
$str_tmp="{";
|
|
if($id)
|
|
$msg=get_db_msg("select * from ".$table_pre."log where id='".$id."'");
|
|
if(!$msg["id"])
|
|
exit("对不起,该信息不存在!");
|
|
$tmp=get_db_msg("select * from ".$table_pre."user where id='".$msg["uid"]."'");
|
|
$str_tmp.="\"username\":\"".$tmp["username"]."\",";
|
|
$str_tmp.="\"ip\":\"".$msg["ip"]."\",";
|
|
$str_tmp.="\"bz\":\"".dhtmlchars($msg["remark"])."\",";
|
|
$str_tmp.="\"action\":\"".$msg["action"]."\",";
|
|
$str_tmp.="\"sql\":\"".dhtmlchars($msg[sql_value])."\",";
|
|
$str_tmp.="\"add_date\":\"".date("Y/m/d H:i",$msg["add_date"])."\",";
|
|
$json_data=$str_tmp;
|
|
break;
|
|
case "del":
|
|
$id=(is_array($id))?$id:array($id);
|
|
$num=count($id);
|
|
for($i=0;$i<$num;$i++){
|
|
$db->query("delete from ".$table_pre."log where id='".$id[$i]."'");
|
|
}
|
|
$json_data.="\"code\":1,";
|
|
break;
|
|
default :
|
|
//
|
|
$page=$page>0?$page:1;
|
|
$limit=$limit>0?$limit:10;
|
|
$start=($page-1)*$limit;
|
|
$end=$limit;
|
|
//
|
|
$sql_con="";
|
|
if($s_date_start){
|
|
$tt=explode("-",$s_date_start);
|
|
$stamp=mktime(0,0,0,$tt[1],$tt[2],$tt[0]);
|
|
$sql_con.="and add_date>='".$stamp."' ";
|
|
}
|
|
if($s_date_end){
|
|
$tt=explode("-",$s_date_end);
|
|
$stamp=mktime(23,59,59,$tt[1],$tt[2],$tt[0]);
|
|
$sql_con.=" and add_date<='".$stamp."' ";
|
|
}
|
|
if($s_ip)
|
|
$sql_con.="and ip like '%".$s_ip."%' ";
|
|
if($s_action){
|
|
$sql_con.=" and action='".$s_action."'";
|
|
}
|
|
if($s_uidd){
|
|
$sql_con.=" and uid='".$s_uidd."'";
|
|
}
|
|
//取得选项1
|
|
$q="select * from ".$table_pre."user order by username";
|
|
$r=$db->query($q);
|
|
while($m=$db->fetch_array($r)){
|
|
$pinjie.="{\"no\":\"".$m["id"]."\",\"title\":\"".$m["username"]."\"},";
|
|
}
|
|
$xuanxiang1="\"xuanxiang1\":[".substr($pinjie,0,-1)."]";
|
|
//选项2
|
|
$pinjie="";
|
|
$q="select distinct(action) 'action' from ".$table_pre."log order by action";
|
|
$r=$db->query($q);
|
|
while($m=$db->fetch_array($r)){
|
|
$pinjie.="{\"no\":\"".$m["action"]."\",\"title\":\"".$m["action"]."\"},";
|
|
}
|
|
$xuanxiang2="\"xuanxiang2\":[".substr($pinjie,0,-1)."]";
|
|
//取得总数
|
|
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."log where id>0 ".$sql_con);
|
|
$total_num=$tmp["num"];
|
|
$query="select * from ".$table_pre."log where id>0 ".$sql_con." order by add_date desc limit ".$start.",".$end;
|
|
//echo $query."<br>";
|
|
$res=$db->query($query);
|
|
$count=0;
|
|
$json_data.="\"xx1\":\"".$s_uidd."\",\"xx2\":\"".$s_action."\",".$xuanxiang1.",".$xuanxiang2.",\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
|
|
$str_tmp="";
|
|
while($msg=$db->fetch_array($res)){
|
|
if($msg["uid"]>0){
|
|
$tmp=get_db_msg("select * from ".$table_pre."user where id='".$msg["uid"]."'");
|
|
$user_name=$tmp["username"];
|
|
}else{
|
|
$user_name="系统消息";
|
|
}
|
|
$list=$count_first+$count+1;
|
|
$action_href="'".$_SERVER[PHP_SELF]."?_m=manage/view&_t=log&id=".$msg["id"]."','log',500,600";
|
|
$str_tmp.="{";
|
|
$str_tmp.="\"id\":\"".$msg["id"]."\",";
|
|
$str_tmp.="\"bh\":\"".$list."\",";
|
|
$str_tmp.="\"username\":\"".$user_name."\",";
|
|
$str_tmp.="\"ip\":\"".$msg["ip"]."\",";
|
|
$str_tmp.="\"bz\":\"".dhtmlchars($msg["remark"])."\",";
|
|
$str_tmp.="\"action\":\"".$msg["action"]."\",";
|
|
$str_tmp.="\"add_date\":\"".date("Y/m/d H:i",$msg["add_date"])."\"";
|
|
$str_tmp.="},";
|
|
$count++;
|
|
}
|
|
$json_data.=substr($str_tmp,0,-1)."],";
|
|
break;
|
|
}
|
|
}
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
?>
|