php and flash

hello, i built a flash site with a 6 sound clip downloads, when somone
clicks the link i want it to count which song has been downloaded using php
to store the info. below is what i have at the moment, which works fine for
one song but i was wondering if anybody here would be good enought to take a
look and tell me how i could modify it to count all 6 sound clips.

within my flash site i have a download button with the folloing
actionscript.

loadVariablesNum("PHPCounter.php?ran="+random(99), 0);

PHPCounter.php and contains the following
<?

$filename = "PHPCounter.txt";

$fp = fopen( $filename,"r");
$Old = fread($fp, 100);
fclose( $fp );

$Old = split ("=", $Old, 5);

$NewCount = $Old[1] + '1';

$New = "Count=$NewCount";

$fp = fopen( $filename,"w+");
if (flock($fp, 2)) {
fwrite($fp, $New, 100); }
fclose( $fp );

print "Count=$NewCount";

?>

my txt file named PHPCounter contains...

Count=1

flash stats page

actionscript = loadVariablesNum("PHPCounter.txt?ran="+random(99), 0);

and dynamic text var = count
brian goodall [ Do, 22 Februar 2007 00:48 ] [ ID #1638203 ]
PHP » alt.php » php and flash

Vorheriges Thema: upload - return to the calling script or make it in single file
Nächstes Thema: mime types