📄 user.php
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
?>
<html>
<head>
<title>网络会议用户列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language=JavaScript>
window.setTimeout('this.location.reload();',30000);
</script>
</head>
<body class="bodycolor" class="small">
<div align="center">
<?
$CUR_TIME=date("Y-m-d H:i:s",time());
$CUR_DATE=date("Y-m-d",time());
$CUR_HOUR=date("H",time());
$CUR_MIN=date("i",time());
$USR_FILE="msg/".$MEET_ID.".usr";
$MSG_FILE="msg/".$MEET_ID.".msg";
if(!file_exists($USR_FILE))
{
$fp=fopen($USR_FILE,"a+");
flock ($fp,2);
fclose($fp);
}
$LINES=file($USR_FILE);
$LINES_COUNT=count($LINES);
if($LINES_COUNT>500)
{
$fp=fopen($USR_FILE,"w");
flock ($fp,2);
fclose($fp);
$LINES=file($USR_FILE);
$LINES_COUNT=count($LINES);
}
$USER_FOUND=0;
$MSG_NEW="";
$USER_LIST="";
for($I=0;$I<$LINES_COUNT;$I++)
{
//-- 找到 USER_ID 行 --
if($I%3==0)
{
$POS=strpos($LINES[$I],chr(10));
$USER_ID=substr($LINES[$I],0,$POS);
//-- 如果是本用户,则更新最新在线时间 --
if($USER_ID==$LOGIN_USER_ID)
{
$LINES[$I+1]=$USER_NAME;
$LINES[$I+2]=$CUR_TIME;
$USER_FOUND=1;
$USER_LIST.=$USER_ID.",";
$USER_NAME_LIST.=$USER_NAME.",";
}
//-- 更新时间在1分钟内的用户视为在线用户 --
else
{
$POS=strpos($LINES[$I+2],chr(10));
$REFRESH_TIME=substr($LINES[$I+2],0,$POS);
$STR=strtok($REFRESH_TIME," ");
$DATE=$STR;
if(compare_date($CUR_DATE,$DATE)==0)
{
$STR=strstr($REFRESH_TIME," ");
$STR=strtok($STR,":");
$HOUR=$STR;
$STR=strtok(":");
$MIN=$STR;
if((($CUR_HOUR*60+$CUR_MIN)-($HOUR*60+$MIN))<2)
{
$USER_LIST.=$USER_ID.",";
$POS=strpos($LINES[$I+1],chr(10));
$STR=substr($LINES[$I+1],0,$POS);
$USER_NAME_LIST.=$STR.",";
}
}
}
}
//-- 存储所有的用户信息 --
$STR=$LINES[$I];
$POS=strpos($STR,chr(10));
if($POS>0)
$STR=substr($STR,0,$POS);
$STR.="\n";
$MSG_NEW=$MSG_NEW.$STR;
}
//-- 未找到本用户,则加入本用户信息 --
if($USER_FOUND==0)
{
$MSG_NEW.=$LOGIN_USER_ID."\n";
$MSG_NEW.=$USER_NAME."\n";
$MSG_NEW.=$CUR_TIME."\n";
$USER_LIST.=$LOGIN_USER_ID.",";
$USER_NAME_LIST.=$USER_NAME.",";
}
//-- 写入新文件 ---
$fp=fopen($USR_FILE,"w");
flock ($fp,2);
fwrite($fp,$MSG_NEW);
//-- 显示在线用户 --
$ARRAY_ID=explode(",", $USER_LIST);
$ARRAY_NAME=explode(",", $USER_NAME_LIST);
$USER_COUNT=count($ARRAY_ID)-1;
?>
<span class="big1"><b>会场共<?=$USER_COUNT?>人</span><br><br>
<?
for($I=0;$I<$USER_COUNT;$I++)
{
?>
<a href="javascript:parent.chat_input.say_to('<?=$ARRAY_ID[$I]?>','<?=$ARRAY_NAME[$I]?>');"><?=$ARRAY_NAME[$I]?></font></a><br>
<?
}
?>
</div>
<script>
window.status="网络会议 - 刷新用户列表";
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -