手机
当前位置:查字典教程网 >编程开发 >php教程 >网站当前的在线人数
网站当前的在线人数
摘要:这是我的多用户统计的在线统计部分gb_temp表:temp1用户IDtemp2流览IP地址temp3online//做了个标记,因为其他功能...

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

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网站提速三大“软”招

我的论坛源代码(五)

编写自己的php扩展函数

Yii实现自动加载类地图的方法

建立灵巧结构的PHP程序

PHP文本数据库的搜索方法

如何使用PHP中的字符串函数

GD输出汉字的函数的分析

无限级别菜单的实现

php使用curl打开https网站的方法

精品推荐
分类导航