 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
veasna
Joined: 15 May 2007 Posts: 56
|
Posted: Tue Nov 06, 2007 5:14 pm Website Counter |
|
|
|
If someone view my website, and other one view my
website too. Can you tell me how to count amount of
website viewer?
Thanks |
|
camoman666

Joined: 24 Jun 2006 Posts: 362 Location: Fort Walton Beach, FL, USA
|
Posted: Sun Dec 02, 2007 11:07 am |
|
|
|
Yes you can, you would do it like this,
Make a text file on your server named "views.txt". In the text file, type the number 0 and save it. Put "views.txt" in the same folder as the page you want to count the views on. Place the following code in the PHP file of the page you want to count the views on.
| Code: |
<?
$file_name = "views.txt";
$file_a = fopen($file_name, 'r');
$views = fread($file_a, filesize($file_name));
fclose($file_a);
(int)$views;
$views += 1;
$file_b = fopen($file_name, 'w');
fwrite($file_b, $views);
fclose($file_b);
?>
<center style="position: absolute; bottom: 0px;">Page Views: <?echo $views;?></center> |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|