Welcome, Guest
  • Author Topic: THERE IS A GOD!! GUESTBOOK V1 WORKING  (Read 5540 times)

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    THERE IS A GOD!! GUESTBOOK V1 WORKING
    « on: 10/04/09, 00:30 »
    Ok I have been struggling for the past few month wit hgetting a GUESTBOOK
    I even bought 2 of them but found them BUGGIE and needing more functionality

    I just cracked a big nut for me - I am drawing the GUESTBOOK SWF file into my main movie's SWF

    I figured out with the help from this website and past entries

    I have to draw the GUESTBOOK'S SWF file into my  _root.myLoader

    loadVariables ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999),_root.myLoader);

    I had to change this wherever it occurs

    I know the loadVariables is old code but heck it worked

    I also figured out how to get rid of the "f" that was occuring in the original PHP file for the time stamp
    This code works great
    // Gets the current Date of when the entry was submitted
       $Today       = (date ("l dS F Y( h:i:s A )",time()));

    Thanks to EVERYONE ON THIS SITE WE ROCK!!
    Now to fix the scroll stuff

    :)

    kibba

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #1 on: 06/29/10, 08:24 »
    Thanks for information.

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #2 on: 10/01/10, 02:50 »
    Hi Mark,

    Good for you! ;D.
    I can't get mine to work.
    Read tons of entries on this board but can't find out wat's the problem.

    My son made a flash site for my wife's business (http://www.ikbiedzorg.com) .
    Last week he added the GuestBook(v1).
    I can ad text, the txt-file is writable but there seems to be no communication from the txt-file back to (php) flash.
    PHP version     5.2.14

    The original guestbook is also on my server here: http://www.ikbiedzorg.com/gb/GuestBook.swf
    Thats not properly working either... Entries are overwritten, format of texst is not looking good.

    If someone has a idea pls give me a hand
    would appreciate it very much!

    -Jos
    « Last Edit: 10/01/10, 07:24 by maas »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #3 on: 10/01/10, 08:00 »
    Hi, and welcome to the boards.

    I just signed your guestbook.
    I guess, it is the old, allmost original guestbook of this site.

    You seem to use a unusual font, and did not embed all needed glyphs.
    The guestbook itself is written, but you modified something inside of the php script, so the entry is not prepended, as it was in the original.

    In the original script, the old text is read and appended to the new one, before the complete guestbook is rewritten.

    Have a look into the php file.

    This tutorial is only to show you, how flash communicates to a script and a little about how php is handling textfiles.
    If you want to write format codes (html tags) into the text, you have to handle this by yourself.

    In this case you have to "html enable" the textbox and assign the content to the htmlText attribute of it.
    happy flashing
    8)
    Ronald

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #4 on: 10/01/10, 13:51 »
    Hi Ronald,

    Thank you for looking into my trubles :).
    This is the content of the php-file:

    <?php
    // If you are using an old version of php, remove the next set of lines.
    // or use $HTTP_POST_VARS["..."] instead.
    $Submit    = $_POST["Submit"];
    $Name       = $_POST["Name"];
    $Email       = $_POST["Email"];
    $Website    = $_POST["Website"];
    $Comments    = $_POST["Comments"];
    $NumLow    = $_REQUEST["NumLow"];
    $NumHigh    = $_REQUEST["NumHigh"];

    // Replace special characters - you can remove the next 5 lines if wanted.
    $Name       = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
    $Email       = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
    $Comments   = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
    $Website    = eregi_replace("http://", "", $Website);
    $Website    = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

    // Remove slashes.
    $Name       = stripslashes($Name);
    $Email       = stripslashes($Email);
    $Website    = stripslashes($Website);
    $Comments    = stripslashes($Comments);

    // ###################################################################################
    // ########## Reading and Writing the new data to the GuestBook Database #############

    if ($Submit == "Yes") {
    // Next line tells the script which Text file to open.
       $filename    = "GuestBook.txt";

    // Opens up the file declared above for reading

       $fp       = fopen( $filename,"r");
       $OldData    = fread($fp, 80000);
       fclose( $fp );

    // Gets the current Date of when the entry was submitted
       $Today       = (date ("l dS of F Y ( h:i:s A )",time()));

    // Puts the recently added data into html format that can be read into the Flash Movie.
    // You can change this up and add additional html formating to this area.  For a complete listing of all html tags
    // you can use in flash - visit: http://www.macromedia.com/support/flash/ts/documents/htmltext.htm

       $Input = "Name: <b>$Name</b><br>Email: <b><u><a href=\"mailto:$Email\">$Email</a></u></b><br>Website: <b><u><a href=\"http://$Website\" target=\"_blank\">$Website</a></u></b><br>Comments: <b>$Comments</b><br><i><font size=\"-1\">Date: $Today</font><br><br>.:::.";

    /* This Line adds the '&GuestBook=' part to the front of the data that is stored in the text file.  This is important because without this the Flash movie would not be able to assign the variable 'GuestBook' to the value that is located in this text file  */

       $New = "$Input$OldData";

    // Opens and writes the file.

       $fp = fopen( $filename,"w");
       if(!$fp) die("&GuestBook=cannot write $filename ......&");
       fwrite($fp, $New, 800000);
       fclose( $fp );
    }

    // ###################################################################################
    // ######### Formatting and Printing the Data from the Guestbook to the Flash Movie ##



    // Next line tells the script which Text file to open.
       $filename = "GuestBook.txt";

    // Opens up the file declared above for reading

       $fp    = fopen( $filename,"r");
       $Data    = fread($fp, 800000);
       fclose( $fp );

    // Splits the Old data into an array anytime it finds the pattern .:::.
       $DataArray = split (".:::.", $Data);

    // Counts the Number of entries in the GuestBook
       $NumEntries = count($DataArray) - 1;

       print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
       for ($n = $NumLow; $n < $NumHigh; $n++) {
       print $DataArray[$n];
          if (!$DataArray[$n]) {
             Print "<br><br><b>No More entries</b>";
          exit;
          }
       }
    ?>

    As far as I can see nothing special to it...
    The movie does something strange as well: It does not work the 'if else' statement for the user fields: name, email etc...
    it always posts the entry...

    Thank you for your time :)
    Best regards,
    Jos
    « Last Edit: 10/01/10, 13:57 by maas »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #5 on: 10/01/10, 15:27 »
    The code seems ok.
    How are the rights set to the GuestBook.txt file?
    You can see this inside of your ftp program.
    happy flashing
    8)
    Ronald

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #6 on: 10/02/10, 01:20 »
    The rights are set to 666 (rw-rw-rw-).
    That should be ok. I'll tried with 777 but the results are the same.
    Thx for making time :)

    Jos
    « Last Edit: 10/02/10, 01:24 by maas »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #7 on: 10/02/10, 14:32 »
    Did you check, if the file is readable?

    It looks like your read action dies not deliver the file content.
    This results in loss of old entries, which is not realy funny.

    I did not find a typo, but the behaviour looks like one.

    Double check the code and filename again.
    happy flashing
    8)
    Ronald

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #8 on: 10/03/10, 02:19 »
    Hi Mark,

    where do i check this? Chmod is ok.
    Php is ok. if I run the php-file on the server this is what I get:

    &TotalEntries=13&NumLow=&NumHigh=&GuestBook=

    So the script can read a part of the entries (its devides the entries ans calculates them) but thats it... :(.
    Any help would be appreciated.
    Jos

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #9 on: 10/03/10, 03:59 »
    NumLow and NumHigh are not set (empty)

    So the loop
    Code: [Select]
    for ($n = $NumLow; $n < $NumHigh; $n++) is not running.

    Make sure, that at first NumLow is set to 0 and NumHigh to 10.
    If your "next 10" button is pressed, NumLow=NumHigh and NumHigh=NumHigh+10;
    happy flashing
    8)
    Ronald

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #10 on: 10/03/10, 05:43 »
    this is the code that I have on the buttons:
    on (release) {
       if (NumLow == "0") {
       GuestBook = "No more before 0";
       }
       else {
        NumLow = Number(NumLow) - Number(10);
       NumHigh = Number(NumHigh) - Number(10);
       GuestBook = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
       loadVariablesNum ("http://www.ikbiedzorg.com/GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
       }
    }


    and

    on (release) {
       NumLow = Number(NumLow)+Number(10);
       NumHigh = Number(NumHigh)+Number(10);
       GuestBook = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
       loadVariablesNum ("http://www.ikbiedzorg.com/GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
    }

    they look ok...
    Jos

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #11 on: 10/03/10, 08:45 »
    First of all - it is the old Flash5 AS1 code.

    To get it more robust and more effective, read into using LoadVars objects.

    But youre problem is, that the variables NumLow and NumHigh are not initialized.
    So you in your calculation you will receive a NaN error, which means, you are trying a numeric operation on a non numeric variable.

    Just assign at first a 0 to NumLow and a 10 to NumHigh to start with.
    happy flashing
    8)
    Ronald

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #12 on: 10/03/10, 11:51 »
    Hi Mark,

    Thx for your patience :P.

    This is the code on the send button:
    on (release) {
       if (Name eq "") {
          _root.Status = "Please enter your name";
       } else if (Email eq "") {
          _root.Status = "Please enter email Address";
       } else if (Website eq "") {
          _root.Status = "Please enter the URL to your website";
       } else {
          Submit = "Yes";
          NumHigh = 10;
          NumLow = 0;
          _root.GuestBook = "Processing..   Loading New... ";
          loadVariablesNum ("GuestBook.php", 0, "POST");
          _root.Status = "Your entry has been submitted.  You should see your comments appear immediately";
          gotoAndStop (2);
       }
    }

    So, NumLow is set to 0 and NumHigh = set to 10 right?

    So... I dont understand 'wy and even where i should declare NumLow and NumHigh as you suggest.
    Thx
    Jos

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #13 on: 10/04/10, 00:44 »
    The problem is in your receiving funktion.
    You now send off ok, the data is received, but not copied into the text box.
    There are allways letters missing, and you only copy the first entry into the field.

    btw. my name is NOT Mark
    happy flashing
    8)
    Ronald

    maas

    • Server what's that
    • *
    • Posts: 11
    • nothing endures but change...
      • View Profile
    Re: THERE IS A GOD!! GUESTBOOK V1 WORKING
    « Reply #14 on: 10/04/10, 03:54 »
    Hi Ronald ;D,

    Sorry for calling you Mark (twice  >:()

    In know that, but what can i do to make it functional?
    BR,
    Jos