PDA

View Full Version : PHP Counter Problems


Motion2082
10-29-2003, 06:22 AM
Hi all

Having problems with my PHP on my website. I have attached all the files that I am using.

I have embedded the Counter within my main swf. Would it make a difference if I loaded it as an external swf?

Or do you guys think it is a scripting issue?

Billy T
10-29-2003, 08:20 AM
<?php echo $_GET['count'];

is missing the ?> at the end

Motion2082
10-29-2003, 08:40 AM
so it is ;)

thx Billy

Motion2082
10-29-2003, 08:58 AM
still not working unfortunately

I have changed the PHP to the following:


<?php $fd = fopen("counter.txt", "w");
fwrite($fd, "count=".$_GET['count']."&loaded=1");
fclose($fd); ?>
<p>Counter incremented: value is now <?php echo $_GET['count'];
?>


Uploading the changes now, Hopefully this will be ok

Billy T
10-29-2003, 06:58 PM
here's one that works

make sure that the text file you write to has the permissions set to allow php (or everyone) to write to it

cheers

Motion2082
10-30-2003, 04:37 AM
either there is something wrong with my server or my computer. I get the error message but no number.

For example: http://www.dicksoncreativedesigns.com

all file permissions were set to 665 then I changed them again to 777 & on both settings the PHP did not work. What puzzles me the most is my Contact.PHP works on my server but the counter.PHP does not want to cooperate.

Why does the TXT file have the numeric value 8 not 0?

In my Attributes do I need to enable any of the following:
Owner; Set UID
Group; Set GID
Public; Sticky

Motion2082
10-30-2003, 04:52 AM
I found another PHP counter that uses the following script


<?php
$rawData = file("counter.txt");
$rawData[0] = rtrim(rawData[0]);
$numData = sprintf("%d", $rawData[0]);
$numData++;

unlink("counter.txt");
$filePointer = fopen("counter.txt", "w");
$strData = sprintf("someCounter=%s", $numData);
fputs($filePointer, "$strData\r\n");
fclose($filePointer);
?>


Uses the same 3 frame FLA file I was using but on Frame 1 the script has been changed to as follows:


if(startup == FALSE)
{
startup = TRUE;
loadVariables("counter.txt", "_root.countTarget");
}


I have not had a chance to test this as yet.

Billy T
10-30-2003, 07:54 AM
ok

what happens if you load the php file straight in the browser

ie

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

?

Motion2082
10-30-2003, 08:34 AM
The following is displayed...

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, Pauld_idesign@Hotmail.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.



--------------------------------------------------------------------------------

Apache/1.3.27 Server at www.dicksoncreativedesigns.com Port 80

Billy T
10-30-2003, 09:05 AM
weird...please upload the relevant files (dont need the flas) and I'll try on my server

Motion2082
10-30-2003, 09:19 AM
That's what I thought also....wierd, I tried doing the same thing with my contact.php file I have on my server. The same message cam up but the PHP still carried out its instructions.

Billy T
10-30-2003, 09:22 AM
works fine for me

http://www.onlinegalleries.com.au/counter/counter.swf

better contact your host

cheers

Motion2082
10-30-2003, 09:25 AM
Yes looks like my server is stuffed :(

Do you think that my web host might be able to fix the problem?

Billy T
10-30-2003, 09:27 AM
I really dont know sorry mate

Good luck

Motion2082
10-30-2003, 09:28 AM
Thanks so much for your help anyway Billy!!!!

Motion2082
10-31-2003, 04:09 AM
Well I got in contact with my Web Host today. Apparantly they do support PHP & all other server technologies.

Are you sure you used all the files from this attachment to get the PHP file working on your website?

Also what did you set your attributes for the following?:
counter.php;
count_data.txt;
counter.swf

One last question did you place these files in the cgi-bin or home folder or both?

Billy T
10-31-2003, 04:18 AM
I just placed them in a normal directory, made the text file world writable and loaded the swf in the browser

cheers

Motion2082
10-31-2003, 05:00 AM
OMG it's working :D

Do I feel like a idiot.

Thank you so much. I'm so glad we sorted that out!!!!

Billy T
10-31-2003, 05:02 AM
what was it?

Motion2082
10-31-2003, 05:14 AM
I placed these files into 2 folders:

counter.php
count_data.txt
counter.swf

One in the "CGI-BIN" & a copy in the "HTML" folder.

There must have been a conflict with doing this. The reason I did this is because counter.swf is a variable & will only work if placed in the "CGI-BIN".

When I took out the .PHP file & the .TXT file from the CGI-BIN the PHP Counter worked ok.

Wierd but now I know what to say when others have problems with PHP/LoadMovie/etc.

Thanks again ;)

Billy T
10-31-2003, 05:20 AM
no prob

Motion2082
10-31-2003, 05:23 AM
http://www.dicksoncreativedesigns.com/counter.swf :D