Selteco.com > FlashDesignerZONE.com > Tutorials > T1097
Flash page hit counter for your website.
You can use loadVariables function to call php file and display page hit counter in your Flash project:
PHP file must return the result in the following format
Where 1324 is the current page hit count.
You can download the counter code and upload it with ftp to your website.
counter.php file contains the following code:
<?php $f = fopen("counter1.txt","r+"); $counter1 = fread($f,filesize("counter1.txt")); $counter1++; fseek($f,0); fwrite($f,$counter1); fclose($f); echo "counter1=" . $counter1; ?>
The counter1.txt file keeps the current hit count value. Create a new text file with Notepad and name it counter1.txt. Open it and enter initial value (for example 1324) in a single line without line break at the end. You have to upload initial counter1.txt file to your website.
If the counter does not increment make sure the counter works directly in the browser. Open your php file with the browser (running it through the server) and refresh it few times to see if the counter works.
Try this link first: http://www.flashdesignerzone.com/tutorials/counter.php to see how the counter increments.
If the counter does not work in the browser make sure the counter1.txt file has proper permissions. Ask your webmaster to change permissions to 755.
Copyright © 1999-2017 Selteco Software, Inc. www.selteco.com, ph: +1 810 377 5778