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."
"; $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; ?>