// simple PHP start at the top of the page since i start a session session_name('mysite_hit_counter'); session_start(); $store_file_data = 'total_save_domain_name_hits_counter.txt'; $live_hit_count = 0; // here online read current hits if (($live_hit_count = file_get_contents($store_file_data)) === false) { $live_hit_count = 0; } // here simple write one more hit if (!isset($_SESSION['page_visited_already'])) { if (($fp = @fopen($store_file_data, 'w')) !== false) { if (flock($fp, LOCK_EX)) { $live_hit_count++; fwrite($fp, $live_hit_count, strlen($live_hit_count)); flock($fp, LOCK_UN); $_SESSION['page_visited_already'] = 1; } fclose($fp); } } ?>