PHP Flash Based Text Hit Counter – Flash Based Hit Counter Using PHP

by Hiroshi on June 13, 2008

in Flash & PHP, Hit Counter II, No Database

Lets create a hit counter in Flash which will store hits data using PHP script. Everytime when that flash file will be played online, it will update the hits data and display it in flash. In this script a blank text file count.txt is being used, and a php script file to store the hits data. Take a dynamic text field in flash movie and name it count and you are done. Name the flash movie counter.swf

PHP File Code (counter.php)

<?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]);
fclose($file);
 
//Returning the count
print "count=".$count[1];
?>

Flah Movie Dynamic Text Field Count Scripting

this.loadVariables("counter.php");

Download File

Related Posts

Previous post:

Next post: