English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

pls give me a php code snippet to track the number of users who hit a page with out using database

2006-08-21 18:26:48 · 4 answers · asked by pakala venkata s 1 in Computers & Internet Software

4 answers

$counterfile = 'counter.txt';
if (file_exists($counterfile)) {
$count = file_get_contents ($counterfile);
if (!is_numeric($count)) {
$count = 0;
}
} else {
$count = 0;
}
$count = $count + 1;
$fp = @fopen($counterfile, 'w');
fwrite($fp, $count);
fclose($fp);

.

2006-08-22 07:08:20 · answer #1 · answered by NC 7 · 0 0

If you want a REAL basic hit counter just open a file and everytime someone goes to the website increment that number in the file. In any case you need to store the number of hits somewhere. Usually you'll want to use something like cookies or IP addresses so you don't count the hits again when someone clicks reload a thousand times.

2006-08-21 18:48:39 · answer #2 · answered by To Be Free 4 · 0 0

particularly circumstances solid human beings out variety undesirable human beings even with the shown fact that it is likewise marvelous that many times undesirable human beings out variety solid human beings. those days politicians in many the international locations are corrupt and are in majority.

2016-12-11 13:01:10 · answer #3 · answered by ? 4 · 0 0

I do not know php, but hope this helps

http://www.tutorialstream.com/tutorials/php-mysql/simple_visits_counter.php

http://www.tizag.com/tools/counter.php

2006-08-21 19:52:05 · answer #4 · answered by qwert 5 · 0 0

fedest.com, questions and answers