📄 user_online.php
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script Language="JavaScript">
var parent_window = parent.dialogArguments;
<?
if($ID==1)
{
$TO_ID="SECRET_TO_ID";
$TO_NAME="SECRET_TO_NAME";
}
else if($ID==2)
{
$TO_ID="COPY_TO_ID";
$TO_NAME="COPY_TO_NAME";
}
else
{
$TO_ID="TO_ID";
$TO_NAME="TO_NAME";
}
?>
function click_user(user_id)
{
TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
targetelement=document.all(user_id);
user_name=targetelement.name;
if(TO_VAL.indexOf(","+user_id+",")>0 || TO_VAL.indexOf(user_id+",")==0)
{
if(TO_VAL.indexOf(user_id+",")==0)
{
parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(user_id+",","");
parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(user_name+",","");
borderize_off(targetelement);
}
if(TO_VAL.indexOf(","+user_id+",")>0)
{
parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(","+user_id+",",",");
parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(","+user_name+",",",");
borderize_off(targetelement);
}
}
else
{
parent_window.form1.<?=$TO_ID?>.value+=user_id+",";
parent_window.form1.<?=$TO_NAME?>.value+=user_name+",";
borderize_on(targetelement);
}
}
function borderize_on(targetelement)
{
color="#003FBF";
targetelement.style.borderColor="black";
targetelement.style.backgroundColor=color;
targetelement.style.color="white";
targetelement.style.fontWeight="bold";
}
function borderize_off(targetelement)
{
targetelement.style.backgroundColor="";
targetelement.style.borderColor="";
targetelement.style.color="";
targetelement.style.fontWeight="";
}
function begin_set()
{
TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
for (step_i=0; step_i<document.all.length; step_i++)
{
if(document.all(step_i).className=="menulines")
{
user_id=document.all(step_i).id;
if(TO_VAL.indexOf(","+user_id+",")>0 || TO_VAL.indexOf(user_id+",")==0)
borderize_on(document.all(step_i));
}
}
}
function add_all()
{
TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
for (step_i=0; step_i<document.all.length; step_i++)
{
if(document.all(step_i).className=="menulines")
{
user_id=document.all(step_i).id;
user_name=document.all(step_i).name;
if(TO_VAL.indexOf(","+user_id+",")<0 && TO_VAL.indexOf(user_id+",")!=0)
{
parent_window.form1.<?=$TO_ID?>.value+=user_id+",";
parent_window.form1.<?=$TO_NAME?>.value+=user_name+",";
borderize_on(document.all(step_i));
}
}
}
}
function del_all()
{
for (step_i=0; step_i<document.all.length; step_i++)
{
TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
if(document.all(step_i).className=="menulines")
{
user_id=document.all(step_i).id;
user_name=document.all(step_i).name;
if(TO_VAL.indexOf(user_id+",")==0)
{
parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(user_id+",","");
parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(user_name+",","");
borderize_off(document.all(step_i));
}
if(TO_VAL.indexOf(","+user_id+",")>0)
{
parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(","+user_id+",",",");
parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(","+user_name+",",",");
borderize_off(document.all(step_i));
}
}
}
}
</script>
<body class="panel" topmargin="0" leftmargin="0" onload="begin_set()">
<?
$CUR_TIME=date("Y-m-d H:i:s",time());
$ONLINE_LIMIT=$ONLINE_REF_SEC+5;
$DEPT_COUNT=0;
$USER_COUNT=0;
$DEPT_ID_PREV="";
$USER_ID_STR="";
$USER_NAME_STR="";
$DEPT_NAME_STR="";
//============================ 显示已定义用户 =======================================
$query = "SELECT * from USER,DEPARTMENT,USER_PRIV where UNIX_TIMESTAMP('$CUR_TIME')-UNIX_TIMESTAMP(LAST_VISIT_TIME)<$ONLINE_LIMIT and USER.USER_PRIV=USER_PRIV.USER_PRIV and USER.DEPT_ID=DEPARTMENT.DEPT_ID order by DEPT_NO,DEPARTMENT.DEPT_ID,PRIV_NO,USER_NO,USER_NAME";
$cursor= exequery($connection,$query);
while($ROW=mysql_fetch_array($cursor))
{
$USER_ID=$ROW["USER_ID"];
$USER_NAME=$ROW["USER_NAME"];
$DEPT_ID=$ROW["DEPT_ID"];
if($DEPT_ID_PREV!=$DEPT_ID)
{
$DEPT_NAME=$ROW["DEPT_NAME"];
$DEPT_COUNT++;
}
$DEPT_NAME_STR.=$DEPT_NAME.",";
$DEPT_ID_PREV=$DEPT_ID;
$USER_ID_STR.=$USER_ID.",";
$USER_NAME_STR.=$USER_NAME.",";
$USER_COUNT++;
}
if($USER_COUNT>0)
{
if($USER_ID_STR!="")
$USER_ID_STR=substr($USER_ID_STR,0,strlen($USER_ID_STR)-1);
if($USER_NAME_STR!="")
$USER_NAME_STR=substr($USER_NAME_STR,0,strlen($USER_NAME_STR)-1);
if($DEPT_NAME_STR!="")
$DEPT_NAME_STR=substr($DEPT_NAME_STR,0,strlen($DEPT_NAME_STR)-1);
$USER_NAME_STR=str_replace(" ", "", $USER_NAME_STR);
$DEPT_NAME_STR=str_replace(" ", "", $DEPT_NAME_STR);
}
if($USER_COUNT==0)
{
Message("","无在线人员!");
exit;
}
?>
<table border="1" cellspacing="0" width="100%" class="small" cellpadding="3" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr class="TableHeader">
<td colspan="2" align="center"><b>全部在线人员</b></td>
</tr>
<tr class="TableContent">
<td onclick="javascript:add_all();" style="cursor:hand" align="center" colspan="2">全部添加</td>
</tr>
<tr class="TableContent">
<td onclick="javascript:del_all();" style="cursor:hand" align="center" colspan="2">全部删除</td>
</tr>
<?
$USER_ID_ARRAY=explode(",",$USER_ID_STR);
$USER_NAME_ARRAY=explode(",",$USER_NAME_STR);
$DEPT_NAME_ARRAY=explode(",",$DEPT_NAME_STR);
for($I=0;$I<$USER_COUNT;$I++)
{
?>
<tr id="<?=$USER_ID_ARRAY[$I]?>" name="<?=$USER_NAME_ARRAY[$I]?>" onclick="javascript:click_user('<?=$USER_ID_ARRAY[$I]?>')" class="menulines" style="cursor:hand" align="center">
<td><?=$DEPT_NAME_ARRAY[$I]?></td><td><?=$USER_NAME_ARRAY[$I]?></td>
</tr>
<?
}
?>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -