SERVER['PHP_SELF']."')"); if(!($insert)) { print "Useronline Insert Failed > "; } //delete the peoples which haven't been online/active in the last $timeoutseconds seconds. $delete = mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout"); if(!($delete)) { print "Useronline Delete Failed > "; } //select the amount of people online, all uniques, which are online on THIS page $result = mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='".
PHP+MYSQL实例:网站在线人数的代码_网学
SERVER['PHP_SELF']."' "); if(!($result)) { print "Useronline Select Error > "; } //Count the number of rows = the number of people online $user = mysql_num_rows($result); //spit out the results mysql_close(); if($user == 1) { print("1 user online\n"); } else { print("$user users online\n"); } ?>