Flash Hit Counter Using ActionScript and PHP

We can create a simple hit counter using flash and PHP script which uses text file for storing hits. I have used a blank count.txt file, and php file. Create a dynamic text field in flash movie and name it count and you are done. Name the flash movie counter.swf or whatever you like.

PHP File Code (counter.php)

//Reading the file
$count = file_get_contents("count.txt"); //Increasing the count
$count = explode("=", $count);
$count[1] = $count[1]+1;
//Writing to file
$file = fopen("count.txt", "w+");
fwrite($file, "count=".$count[1]);
//Returning the count
print "count=".$count[1];

Flah Movie – Dynamic Text Field Count Scripting


Download Flash PHP Hit Counter