在线用户数量显示在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.
顶啊 好贴 很好!
页:
[1]