Current online population of the Ministry of Education's degree and Postgraduate Education Development Centre website

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.