Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 07:15
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Recent Tutorial Support
| |-+  Flash GuestBook Support (Moderators: Flash-db, vesa kortelainen, Ronald Wernecke, Mohsin Sumar, Jorge Solis)
| | |-+  THERE IS A GOD!! GUESTBOOK V1 WORKING
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: THERE IS A GOD!! GUESTBOOK V1 WORKING  (Read 4103 times)
Mark Tara
Server what's that
*
Posts: 15


View Profile Email
« 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

Smiley
Logged
kibba
Server what's that
*
Posts: 5


View Profile Email
« Reply #1 on: 06/29/10, 08:24 »

Thanks for information.
Logged
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« Reply #2 on: 10/01/10, 02:50 »

Hi Mark,

Good for you! Grin.
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 » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« 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.
Logged

happy flashing
Cool
Ronald
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« Reply #4 on: 10/01/10, 13:51 »

Hi Ronald,

Thank you for looking into my trubles Smiley.
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 Smiley
Best regards,
Jos
« Last Edit: 10/01/10, 13:57 by maas » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« 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.
Logged

happy flashing
Cool
Ronald
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« 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 Smiley

Jos
« Last Edit: 10/02/10, 01:24 by maas » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« 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.
Logged

happy flashing
Cool
Ronald
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« 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... Sad.
Any help would be appreciated.
Jos
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #9 on: 10/03/10, 03:59 »

NumLow and NumHigh are not set (empty)

So the loop
Code:
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;
Logged

happy flashing
Cool
Ronald
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« 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
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« 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.
Logged

happy flashing
Cool
Ronald
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« Reply #12 on: 10/03/10, 11:51 »

Hi Mark,

Thx for your patience Tongue.

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
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« 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
Logged

happy flashing
Cool
Ronald
maas
Server what's that
*
Posts: 11

nothing endures but change...


View Profile WWW
« Reply #14 on: 10/04/10, 03:54 »

Hi Ronald Grin,

Sorry for calling you Mark (twice  Angry)

In know that, but what can i do to make it functional?
BR,
Jos
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything