网页功能: 加入收藏 设为首页 网站搜索  
网站当前的在线人数
发表日期:2004-07-22作者:[转贴] 出处:  

这是我的多用户统计的在线统计部分

gb_temp表:
temp1 用户ID
temp2 流览IP地址  
temp3 online//做了个标记,因为其他功能也要使用这个表
temp4 登陆时间

$onlinetime最长离线时间分钟
db_class是我定义的一个数据库操作类。

///////////////////
//在线统计
$db = new db_class;
$db->connect();

$limit_time = time() - ($onlinetime * 60);
$online_time = time();

$db->query("delete from gb_temp where (temp4<$limit_time or temp2='$ip') and temp1='$id' and temp3='online'"); //删除离线$onlinetime分钟的用户
$db->query("insert into gb_temp (temp1,temp2,temp3,temp4) values ('$id','$ip','online','$online_time')");
$onres = $db->query("select count(*) from gb_temp where temp1='$id' and temp3='online'");
$onlineuser = $db->fetch_array($onres);
$onlineuser = $onlineuser[0]; 

我来说两句】 【加入收藏】 【返加顶部】 【打印本页】 【关闭窗口
中搜索 网站当前的在线人数
本类热点文章
  用PHP验证邮箱是否真实有效
  PHP5的变化与PHP6展望
  用户IP、浏览器、操作系统
  oracle资料库函式库
  oracle资料库函式库
  基于PHP的聊天室(二)
  基于PHP的聊天室(二)
  php调用mysql存储过程和函数的方法
  正则表达式在网络编程中的运用
  专家预言:PHP将比Java更受欢迎
  高效的中文字符串截取函数
  高效的中文字符串截取函数
最新分类信息我要发布 
最新招聘信息

关于我们 / 合作推广 / 给我留言 / 版权举报 / 意见建议 / 广告投放  
Copyright ©2003-2024 Lihuasoft.net webmaster(at)lihuasoft.net
网站编程QQ群   京ICP备05001064号 页面生成时间:0.01084