Php simple counter & lt ;? Php1 ------ cookie counter if (isset ($ _ COOKIE [num]) {$ num $ _ COOKIE [num] + 1;} else {$ num1;} setcookie (num, $ num); echoYouarethe. $ num. timesvisit. php simple counters
"; // 2 ------- text counter $ file =" ../counter/count. dat "; if (! File_exists ($ file) {$ num_txt = 1;} else {$ num_txt = file_get_contents ($ file); $ num_txt ++;} $ fp = fopen ($ file, "w"); fwrite ($ fp, $ num_txt); fclose ($ fp); echo "You are ". $ num_txt. "times visit. "."
"; // 3 ------- anti-refresh counter $ file =" ../counter/count. dat "; if (! File_exists ($ file) {$ fp = fopen ($ file, "w"); fwrite ($ fp, "0"); fclose ($ fp );} $ num_txt = file_get_contents ($ file); session_get_cookie_params (24*3600); session_start (); if (! Isset ($ _ SESSION ["visited"]) {$ num_txt ++; $ fp = fopen ($ file, "w"); fwrite ($ fp, $ num_txt ); fclose ($ fp); $ _ SESSION ["visited"] = "true";} echo "You are ". $ num_txt. "times visit. "."
"; // 4 -------- Image counter, same as above. The image corresponding to the 0-9 number needs to be converted. // 5 --------- multi-user counter, which exists in the database?>