PaulD  
                
                  
                    October 28, 2003,  3:10am
                   
                  1 
               
             
            
              Hi everyone
I have found this PHP Counter on the net but when applied to my Webpage it does not work.
Just wondering if anyone can take a look if they get a spare second or two.
I have attached the file dynamic_counter.zip
this is what it looks like in action on my websitehttp://www.dicksoncreativedesigns.com 
as you can see the counter is not displaying 
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 10:07am
                   
                  2 
               
             
            
              Does your host support PHP?
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 10:24am
                   
                  3 
               
             
            
              Yes it does support PHP, I have a contact form using PHP & that works ok.
Wierd :h:
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 10:54am
                   
                  4 
               
             
            
              Hmm…there aren’t any instructions with that thing, but I think you might have to CHMOD the text file in order for it to work.
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 11:08am
                   
                  5 
               
             
            
              CHMOD the text file. How do I do that?
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 11:12am
                   
                  6 
               
             
            
              Some FTP programs has that feature.
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 11:20am
                   
                  7 
               
             
            
              I’m using FlashFXP FTP Program, do I have to tell the txt file to be CHMOD? What is CHMOD?
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 11:22am
                   
                  8 
               
             
            
              Yes, you’ll need to do it through whichever FTP program you have if it has that feature.
CHMOD basically allows the the information in the text file to be read or written over.
EDIT: I also believe you’ll need to CHMOD it 777, but I’m not sure.
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003, 12:06pm
                   
                  9 
               
             
            
              ok I will see what I can do, thx for the info!!!
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003,  1:19pm
                   
                  10 
               
             
            
              Ok I managed to work out what I was doing wrong & thought I would let you know.
I needed to change the file permissions on my web server to READ,WRITE,EXECUTE.
The Chmod php file was 665 (-rw-rw-r-x) and the text file was 666 (-rw-rw-rw-).
Thanks for your help 
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003,  4:04pm
                   
                  11 
               
             
            
              I was using PHP3 which I dont think the server supports, hopefully by updating the actionscript to PHP will allow the counter to function.
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003,  4:09pm
                   
                  12 
               
             
            
            
              
            
           
          
            
              
                system  
              
                  
                    October 28, 2003,  7:21pm
                   
                  13 
               
             
            
              For future reference, flashfxp chmod shortcut is ctrl+o or just right click the file and select CHMOD (right clicking also shows the shortcut). Since you changed the file extension be sure to re-read the code and be sure that all referenced files are .php now and not .php3
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  4:14pm
                   
                  14 
               
             
            
              Ok I have changed my PHP script 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'];?>
Still does not seem to be functioning
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  5:41pm
                   
                  15 
               
             
            
              Some things to try out… I use text files all the time…
First, don’t you need to read what count to increment before you actually can increment it?
I’ll make you a quick script that should work for ya…
Here…
<?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("%s", $numData);
fputs($filePointer, "$strData
");
fclose($filePointer);
?>
It may look like alot for a simple counter. But this will ensure that no variable changeovers get in the way of placing a better counter in your system. It automatically updates it’s numbers so it’s alot easier.
I don’t know why they had the GET global variable set used in your example… That would only work everytime someone sent a form or something… Weird.
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  5:57pm
                   
                  16 
               
             
            
              @ Bhuddamarz
Here is the location of the source files I am currently using.
< http://www.dicksoncreativedesigns.com.temp/counter.zip  >
Do you suggest I change the “counter.php” scripting to the one you have specified below?
I will give it a try…
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  6:16pm
                   
                  17 
               
             
            
              It still did not work even with your modified script. Thank you for trying.
I’m think that there is something wrong with this script on Frame1 of my FLA file.
[AS]
shouldn’t the “/counter” be “/counter.php” ?
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  7:14pm
                   
                  18 
               
             
            
              Ohhhhh! You want this made for flash… lmfao … Oh **** man… Hold on… lemme get you some newer script… lmao … Sorry…
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  7:26pm
                   
                  19 
               
             
            
              Paul, please excuse Marlin here, he’s been smoking too much butt crack lately. :beam:
             
            
              
            
           
          
            
              
                system  
              
                  
                    October 29, 2003,  7:37pm
                   
                  20 
               
             
            
              if (startup eq “”)
Exactly what does this line here do? Is this a part of the new MX 2004 or is it just wrongly written?
Ohhh NEver mind… It’s a eq… lmao … Actually… Why don’t you do this…
if(startup == FALSE)
{
     startup = TRUE;
     loadVariables("counter.txt", "_root.countTarget");
}
The countTarget should be a textfield located on your movie… Should be in Frame 1 along with this coding. name it countTarget. On the text field, you should also change the variable setting as well… Give it a name of : someCounter.
Also… Change around the php code I gave you… One tiny bit and save it as this…
<?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
");
 fclose($filePointer);
?>
See if that works out for you… I’m sorry if it doesn’t… I haven’t worked with loadVariables in a while