yaotie 发表于 2002 年 7 月 29 日 00:00:00

在线用户数量显示在Header / Footer

************************************************
** Number of online users in header / footer! **
************************************************
1. Add the following code to your phpinclude template (PHP-Parsed code):
************************************************************
// start - get online users (hack by firefly)
$datecut=time()-$cookietimeout;
$headerguests=$DB_site->query_first("SELECT COUNT(*) AS count FROM session WHERE userid=0 AND lastactivity>$datecut");
$headerusers=$DB_site->query_first("SELECT COUNT(DISTINCT(userid)) AS count FROM session WHERE session.userid>0 AND session.lastactivity>$datecut");
$headerguests=$headerguests;
$headerusers=$headerusers;
$headeronline=$headerguests+$headerusers;
// end - get online users (hack by firefly)
************************************************************

2. Save the template changes.

3. Place $headeronline wherever you want in either your header or footer templates to show number of online users. In addition, you can also use $headerguests to show number of online guests, or $headerusers to show number of online members.

qq270525342 发表于 2011 年 2 月 6 日 21:18:04

顶啊         好贴

AdRiAn伟 发表于 2012 年 7 月 23 日 20:58:27

很好!     
页: [1]
查看完整版本: 在线用户数量显示在Header / Footer