PHP Counter is not working :(

@ buddhamarz

I have not had a chance to test your method as yet but I will try shortly.

Found another example from a guy in Melbourne.

Create a FLA with a Movie Clip 1 Frame Long.

Insert the following actions:

[AS]
counter = new LoadVars();
counter.onLoad = function(ok) {
if (ok) {
counter_txt.text = this.result;

} else {
	counter_txt.text = "????";
}

};
counter.load(“count.php”);
[/AS]
Then make a “count_data.txt” file with saved with the number 8

The PHP is called “count.php” and has the following


<?php
$COUNT_FILE = "count_data.txt";

if (file_exists($COUNT_FILE)) {
	$fp = fopen("$COUNT_FILE", "r+");
	flock($fp, 1);
	$count = fgets($fp, 4096);
	$count += 1; 
	fseek($fp,0);
	fputs($fp, $count);
	flock($fp, 3);
	fclose($fp);
$message="You are visitor number $count";
	echo "result=$message";
} else {
$message="Counter done did break";
	echo "result=$message";
}
?>

I tried this example & managed to get the error message :slight_smile:

Maybe its my computer or maybe its my server? Because every example I try does not seem to work :q:

I just thought I would let you guys know that there is nothing wrong with the script I just gave you.

It has come to my attention that my web host is having problems managing my PHP files. It supports PHP as proven by my contact.php file but for some reason it does not want to support my counter.php

When I get to the bottom of this I will let you guys know what has happened.

Thanks for all your help so far

Well I got in contact with my Web Host today.

Support Guy: “YES we do support all PHP & Server Technologies.”

Me: “So what am I doing wrong if this script works on my friends server but not yours.”

Support Guy: “That is out of our support capabilites, please check your script again”

Me: “Thanks for nothing”


So here is all my files that I am using with file attributes 666…
http://www.dicksoncreativedesigns.com/Counter.zip

Here is the result I get when I upload these files to my server…
http://www.dicksoncreativedesigns.com/counter.swf

Well I solved the problem myself. I deleted all my files uploaded them again, adjusted the attributes & it worked.

Prob was my fault because I had the same files in the cgi-bin. Once I took them out the PHP counter worked.

Im sure my Host could have told me that if they weren’t total idiots. Cheap prices, bad support.

Thanks to everyone who helped me solve this problem.

You can view the workable PHP counter at

http://www.dicksoncreativedesigns.com/counter.swf