This code can count the number of online users on your website. it is supported by php + txt without data. The PHP + txt instance code is as follows :? Php $ timegettimeofday (vo... this code can count the number of online users on your website. it is supported by php + txt without data. The PHP + txt instance code is as follows:
60) {$ fd_time = fopen ("time. text "," w + "); fputs ($ fd_time," "); fclose ($ fd_time );} // update time over // Check ip start $ fd_ip = fopen ("ip. text "," a + "); // obtain the user ip address if ($ http_server_vars [" http_x_forwarded_for "]) {$ ip = $ http_server_vars [" http_x_forwarded_for "];} elseif ($ http_server_vars ["kernel"]) {$ ip = $ http_server_vars ["kernel"];} elseif ($ http_server_vars ["remote_addr"]) {$ ip = $ http_server_v Ars ["remote_addr"];} elseif (getenv ("http_x_forwarded_for") {$ ip = getenv ("Encrypt");} elseif (getenv ("http_client_ip ")) {$ ip = getenv ("http_client_ip");} elseif (getenv ("remote_addr") {$ ip = getenv ("remote_addr ");} else {$ ip = "unknown";} $ ip_adds = file ("ip. text "); for ($ I; $ I <count ($ ip_adds); $ I ++) {if ($ ip. "" = $ ip_adds [$ I]) {$ ip_check = 1; break;} if ($ ip_check! = 1) {fputs ($ fd_ip, $ ip. "") ;}fclose ($ fd_ip); // Check ip over $ ip_adds = count (file ("ip. text ");?>
Call method:
Online users
Total online users of the php100 Forum:
Person <br> user ip address: <? Phpecho"
"; For ($ I = 0; $ I <count ($ ip_adds); $ I ++) {echo"". Substr ($ fd_ip [$ I], 0, 0-strlen (strrchr ($ fd_ip [$ I], '.').". *";} Echo"";?>
Tutorial address:
Reprinted! But please include the article address ^