If (! $ _ SESSION ['name']) session_register ("name ");
######################################## ####
$ Con = mysql_connect ($ host, $ user, $ pw) or die ("no? Connected? Expected ?? Quot ;);
$ Now = time ();
Mysql_select_db ($ db, $ con) or die ("?? ? Expected ?? Db ");
If (! Empty ($ name) {// If yes? Okay? Logged on
$ Query = mysql_query ("select count (username) from online_list where username = '$ name'", $ con); // query? In? To the table? Useful? Taobana? Q
$ Result = mysql_result ($ query, 0); // query? ? Result
If ($ result! = 0) {// If? Okay? In? List
@ Mysql_query ("update online_list set second_time = '$ now' where username = '$ name'", $ con); // used for update? Why are there too many other users ?? R?
} Else {// If yes? Okay? Not in? List
@ Mysql_query ("insert into online_list (username, userip, online_time, second_time) values ('$ name',' $ REMOTE_ADDR ',' $ now ',' $ now ')", $ con); // add one ?? Use? Why? List
}
}
Else {// if Yes?] Yes
$ Query = mysql_query ("select count (userip) from online_list where userip = '$ REMOTE_ADDR'", $ con); // query? In? To the table? Yes? Customer ip address
$ Result = mysql_result ($ query, 0); // query? ? Result
If ($ result! = 0) {// If? Customer IP address already? In? List
@ Mysql_query ("update online_list set second_time = '$ now' where userip = '$ REMOTE_ADDR'", $ con); // update? What is the customer's last ?? R?
} Else {// If yes? Skew?] Yes? Customer IP address
@ Mysql_query ("insert into online_list (username, userip, online_time, second_time) values ('? Ker', '$ REMOTE_ADDR', '$ now', '$ now') ", $ con); // add a question ??? Customer arrival? List
}
}
$ Del_time = $ now-$ update_time;
@ Mysql_query ("delete from online_list where second_time <$ del_time", $ con );//? H except in $ update_time seconds?] Yes? Why ?? Br/> ?>
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