This is the online statistics section of my Multi-user statistics
Gb_temp table:
Temp1 User ID
TEMP2 Overview IP Address
Temp3 online//made a mark, because other functions also use this table
Temp4 Landing Time
$onlinetime the longest offline time minutes
Db_class is a database operation class that I define.
///////////////////
Online statistics
$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 '"); Remove users who are offline $onlinetime minutes
$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];
The above describes the Ministry of Education's degree and Graduate Education Development Center website's current online number, including the Ministry of Education's degree and Graduate Education Development Center website content, I hope the PHP tutorial interested in a friend helpful.