"; //check_session(); $json_data="{"; if($priv[0]=="n"){ //没有操作权限 $json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],"; }else{ $json_data.="\"uid\":".$uid.","; switch($_a){ case "kickout" : //if($priv[0]!="y") //alert_and_back("对不起,权限不够!"); $tmp=get_db_msg("select * from ".$table_pre."session where id='".$id."'"); $lid=$tmp["uid"]; $db->query("delete from ".$table_pre."session where id='".$id."'"); set_log("删除在线客户",$lid); $json_data.="\"code\":1,"; break; case "kickout_all" : $db->query("delete from ".$table_pre."session"); set_log("清空在线客户"); $json_data.="\"code\":1,"; break; case "kickout_30" : $check_time=30*60; $now1=time()-$check_time; $db->query("delete from ".$table_pre."session where lastactivity<".$now1); set_log("清空半小时未操作的在线客户"); $json_data.="\"code\":1,"; break; case "kickout_60" : $check_time=60*60; $now1=time()-$check_time; $db->query("delete from ".$table_pre."session where lastactivity<".$now1); set_log("清空1小时未操作的在线客户"); $json_data.="\"code\":1,"; break; case "delete" : //if($priv[0]!="y") //alert_and_back("对不起,权限不够!"); $num=count($id); //if($num==0) //alert_and_back("请至少选择一条记录!"); for($i=0;$i<$num;$i++){ $tmp=get_db_msg("select * from ".$table_pre."session where id='".$id[$i]."'"); $db->query("delete from ".$table_pre."session where id='".$id[$i]."'"); $lid.=$tmp["uid"]."|".$id[$i].", "; } $lid=substr($lid,0,-2); set_log("删除在线客户",$lid); $json_data.="\"code\":1,"; break; default : $page=$page>0?$page:1; $limit=$limit>0?$limit:50; $start=($page-1)*$limit; $end=$limit; // $order=$order?$order:"lastactivity!"; //$tran_var=array("offset"=>$offset,"page_size"=>$page_size,"_cid"=>$_cid,"_m"=>$_m,"s_keyword"=>$s_keyword,"s_ip"=>$s_ip,"s_server_ip"=>$s_server_ip,"s_khd"=>$s_khd,"s_face"=>$s_face); //$pagesize_option=array(10,20,30,40,50,100); $sql_con=""; if($s_ip || $s_server_ip || $s_keyword || $s_face || $s_khd){ if($s_khd) $sql_con.=" and a.remark='".$s_khd."'"; if($s_face) $sql_con.=" and b.face='".$s_face."'"; if($s_keyword) $sql_con.=" and (b.username like '%".$s_keyword."%' or b.title like '%".$s_keyword."%')"; if($s_ip) $sql_con.=" and a.ip like '%".$s_ip."%'"; if($s_server_ip) $sql_con.=" and a.server_ip like '%".$s_server_ip."%'"; } $sql_order=str_replace("!"," desc",$order); $query="select count(*) 'total' from ".$table_pre."session a,".$table_pre."client b where a.uid=b.id ".$sql_con; //echo $query."----
"; $res=$db->query($query); $msg=$db->fetch_array($res); $total=$msg["total"]; //-----------------------search $arr_client_face=array("1"=>"总经理","2"=>"区域经理","3"=>"代理商","4"=>"店铺","5"=>"陈列师","6"=>"设计师","7"=>"主讲","8"=>"管理员","9"=>"区域"); $arr_khd=array("ipad"=>"ipad","pad8"=>"pad8","mobile"=>"mobile"); //取得定制选项 $select_dz=""; $tmp=""; foreach($arr_client_face as $k1 => $v1){ $tmp.="{\"no\":\"".$k1."\",\"title\":\"".$v1."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"face\",\"title\":\"角色\",\"value\":\"s_face\",\"op\":[".$tmp."]},"; $tmp=""; foreach($arr_khd as $k1 => $v1){ $tmp.="{\"no\":\"".$k1."\",\"title\":\"".$v1."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"khd\",\"title\":\"客户端\",\"value\":\"s_khd\",\"op\":[".$tmp."]},"; //$select_dz.="{\"no\":\"s_khd\",\"title\":\"客户端",\"value\":\"s_khd\",\"op\":[".$tmp."]},"; $tmp=""; $r1=$db->query("select * from ".$table_pre."servers order by ord"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["ip"]."\",\"title\":\"".$m1["ip"]."\"},"; } $tmp=deel_end($tmp); //$select_dz.="{\"no\":\"s_server_ip\",\"title\":\"服务器",\"value\":\"s_server_ip\",\"op\":[".$tmp."]},"; $select_dz.="{\"no\":\"server_ip\",\"title\":\"服务器\",\"value\":\"s_server_ip\",\"op\":[".$tmp."]},"; $select_dz=deel_end($select_dz); $json_data.="\"select_dz\":[".$select_dz."],"; //-----------------------/search //-----------------------act /*if($priv[0]=="y"){ $act=" "; //$act.=" "; //$act.=" "; $act.=" "; } if($s_ip || $s_keyword || $s_face || $s_khd) $act.=" 显示全部";*/ //-----------------------/act //-----------------------tab //-----------------------/tab /*$form_hidden=array( "s_keyword"=>$s_keyword, "s_ip"=>$s_ip, "s_server_ip"=>$s_server_ip, "s_khd"=>$s_khd, "s_face"=>$s_face, "page_size"=>$page_size ); $checkbox_all=""; $column=array( "编号", "角色", $checkbox_all."用户".get_order_action("username",$order,$_SERVER[PHP_SELF],$tran_var), "服务器", "客户端", "IP地址", "访问模块", "最后操作".get_order_action("lastactivity",$order,$_SERVER[PHP_SELF],$tran_var), "操作" );*/ //$column_property=array("align=left width=40","align=left width=60","align=left","align=left width=80","align=left width=60","align=left width=90","align=left width=60","align=center width=120","align=center width=60"); $query="select a.id 'id',a.action '_m',a.remark 'khd',a.ip 'ip',a.server_ip 'server_ip',a.lastactivity 'lastactivity',b.face 'face',b.username 'username',b.title 'title' from ".$table_pre."session a,".$table_pre."client b where a.uid=b.id ".$sql_con."order by ".$sql_order." limit ".$start.",".$end; //echo $query."
"; //exit; //$json_data.="\"q\":".$query.","; $str_tmp=""; $json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total.",\"data\":["; $res=$db->query($query); $count=0; while($msg=$db->fetch_array($res)){ $str_tmp.="{"; $str_tmp.="\"id\":\"".$msg["id"]."\","; $list=$start+$count+1; $str_tmp.="\"xh\":\"".$list."\","; //$content[$count][]=$list; //$content[$count][]=get_main_value($arr_client_face,$msg["face"]); $str_tmp.="\"face\":\"".get_main_value($arr_client_face,$msg["face"])."\","; //$content[$count][]="".$msg["title"]."(".$msg["username"].")"; $str_tmp.="\"user\":\"".$msg["title"]."(".$msg["username"].")"."\","; //$content[$count][]=$msg["server_ip"]; $str_tmp.="\"server_ip\":\"".$msg["server_ip"]."\","; //$content[$count][]=$msg["khd"]; $str_tmp.="\"khd\":\"".$msg["khd"]."\","; //$content[$count][]=$msg["ip"]; $str_tmp.="\"ip\":\"".$msg["ip"]."\","; //$content[$count][]=parse_session_action($msg["_m"]); $str_tmp.="\"fwmk\":\"".parse_session_action($msg["_m"])."\","; //$content[$count][]=date("Y/n/j H:i:s",$msg["lastactivity"]); $str_tmp.="\"zhcz\":\"".date("Y/n/j H:i:s",$msg["lastactivity"])."\""; //$content[$count][]="踢出"; $str_tmp.="},"; $count++; } $json_data.=substr($str_tmp,0,-1)."],"; break; } } $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>