Welcome, Guest
  • Author Topic: Guestbook V2 Doesn't Work  (Read 3617 times)

    DaViDa7

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Guestbook V2 Doesn't Work
    « on: 02/16/11, 15:58 »
    Hello all,

    I tried the v2 version of the guestbook and it doesn't seem to work for me, I have searched all these topics on here but none got my problem fixed. Let me explain the situation

    I loaded in the guestbook flash completely in my own flash file. So not as a movie clip but I mean copied all frames etc. I uploaded it on my host and also got the tables installed on my phpmyadmin server. It is located on this site on the guestbook area. http://icebits.dfx.at/ . First it said undefined until I changed the login details in the php file to the one login in the actual phpmyadmin. Now it keeps in the state of 'loading entries please wait...'. Could anyone please help me?

    Thanks!

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #1 on: 02/16/11, 16:26 »
    the given link does not show any guestbook.

    To find problems with communication, use charles.

    What happens, if you enter the scriptname into your browser?

    Do the entries reach the database (can they be read by phpMyAdmin)?
    happy flashing
    8)
    Ronald

    DaViDa7

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #2 on: 02/17/11, 03:02 »
    http://icebits.dfx.at/ at that adress when you click the guestbook link in the menu it shows the guestbook in the content frame. Yet it doesnt load in the actual messages but keeps saying Loading entries... Please wait.... And yes I loaded the script into phpmyadmin and it created all tables and so on.
    « Last Edit: 02/17/11, 03:04 by DaViDa7 »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #3 on: 02/17/11, 06:44 »
    I just tried to call the Guestbook.php - it says error 500

    This means, there is an error in the php file.
    Check it for typos etc.
    happy flashing
    8)
    Ronald

    DaViDa7

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #4 on: 02/17/11, 09:32 »
    This is the code I got

    <?


    // Part One - Initiate a mySQL Database Connection
    // Database Connectivity Variables and other Variables
       $DBhost = "filled in my host here"   // Database Server
       $DBuser = "my user";            // Database User
       $DBpass = "My pass";            // Database Pass
       $DBName = "davidstolk_icebits";            // Database Name
       $table = "guestbook";             // Database Table
       $numComments = 10;       // Number of Comments per page
       
       // Connect to mySQL Server
       $DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error());
       // Select mySQL Database
       mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error());

    // Part Two - Choose what action to perform
       $action = $_GET['action'];
       
       switch($action) {
          case 'read' :
           // Fetch all comments from database table
           $sql = 'SELECT * FROM `' . $table . '`';
           $allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
           $numallComments = mysql_num_rows($allComments);
           // Fetch page-wise comments from database table
           $sql .= ' ORDER BY `time` DESC LIMIT ' . $_GET['NumLow'] . ', ' . $numComments;
           $fewComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
           $numfewComments = mysql_num_rows($fewComments);
           // Generate Output for Flash to Read
           print '&totalEntries=' . $numallComments . '&';
           print "<br>&entries=";   
          
           if($numallComments == 0) {
              print "No entries in the guestbook, as yet..";
           } else {
              while ($array = mysql_fetch_array($fewComments)) {
                $name = mysql_result($fewComments, $i, 'name');
                $email = mysql_result($fewComments, $i, 'email');
                $comments = mysql_result($fewComments, $i, 'comments');
                $time = mysql_result($fewComments, $i, 'time');
                
                print '<b>Name: </b>' . $name . '<br><b>Email: </b>' . $email . '<br><b>Comments: </b>' . $comments . '<br><i>Date: ' . $time . '</i><br><br>';
                $i++;
              }
          }
          // Print this only when there aren't any more entries..
          if($_GET['NumLow'] > $numallComments) {
             print 'No More Entries!&';
          }
          break;
          
         case 'write' :
            // Recieve Variables From Flash
           $name = ereg_replace("&", "%26", $_POST['yourname']);
           $email = ereg_replace("&", "%26", $_POST['youremail']);
           $comments = ereg_replace("&", "%26", $_POST['yourcomments']);
           $submit = $_POST['submit'];
              
           // Current system date in yyyy-mm-dd format
           $submitted_on = date ("Y-m-d H:i:s",time());
                 
           // Check if its submitted from Flash
           if($submit == 'Yes'){
           // Insert the data into the mysql table
           $sql = 'INSERT INTO ' . $table .
                    ' (`ID`,
                   `name`,
                   `email`,
                   `comments`,
                   `time`
                  )
                  VALUES
                  (\'\','
                   . '\'' . $name . '\','
                   . '\'' . $email . '\','
                   . '\'' . $comments . '\','
                   . '\'' . $submitted_on . '\'
                   )';
           $insert = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
          
           // If you want your script to send email to both you and the guest, uncomment the following lines of code
           // Email Script Begin
          
           /* <-- Remove this line
           $MyName = "Mohsin Sumar";
           $MyEmail = "mohsinsumar@hotmail.com";
           $Subject = "$name has just signed your guestbook.";
           $EmailBody = "Hello Mohsin,\n$name has just signed your guestbook available at http://www.mohsinsumar.com. THe following were the details submitted into your guestbook:\n\nName: $name\nEmail: $email\nComment:\n$comments\n";
          
           $EmailFooter = "~~~~~~~~~~~~~~~\nThe guestbook was signed by $name and thus this email got activated by $name from $REMOTE_ADDR from http://www.mohsinsumar.com\n~~~~~~~~~~~~~~~\nThanking you,\nMohsin Sumar";
          
           $Message = $EmailBody.$EmailFooter;
          
           mail($MyName." <".$MyEmail.">",$Subject, $Message, "From: ".$name." <".$email.">");
           /* <-- Remove this line
          
           // Email Script End
          
           print "&gb_status=Thank you for signing my guestbook.&done=yes&";
           return;
           }
           print "&_root.write.gb_status=Error!&";
           break;
       }
    ?>

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #5 on: 02/17/11, 12:49 »
    try to replace the <? with <?php

    This might allready do it.

    I guess, you changed the entry on usernam and password for your database and the email address for the message sending in the lower section.
    happy flashing
    8)
    Ronald

    DaViDa7

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #6 on: 02/17/11, 15:23 »
    Ok I replaced it but as you can try again its still not working :/ I hope for more help.

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #7 on: 02/17/11, 17:04 »
    as long as you have a 500, there is an error inside of the script.

    You must have chaned the sections with username, password, tablename etc.

    There you might have deletet a quote by accident.

    If the script is not running, debuging is hard to do.
    happy flashing
    8)
    Ronald

    DaViDa7

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #8 on: 02/18/11, 02:58 »
    Thanks! Ok I replaced it with the normal file of the package i downloaded of this site and put my host details in there again. Now Im getting the message : Undefined. Could you please help me out with that? If you could try and test it on my server again maybe you know the problem? Allready thanks! http://icebits.dfx.at/
    « Last Edit: 02/18/11, 03:04 by DaViDa7 »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #9 on: 02/18/11, 03:26 »
    Still there is something wrong with your database connection

    Script says:

    Error in GuestBook Application: Lost connection to MySQL server at 'reading initial communication packet', system error: 111
    happy flashing
    8)
    Ronald

    DaViDa7

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #10 on: 02/18/11, 03:41 »
    Any idea what will be wrong? I mean the login or the actual server? thanks

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Guestbook V2 Doesn't Work
    « Reply #11 on: 02/18/11, 07:59 »
    can you login via phpMyAdmin, using the credentials of the script?
    is the mySQL-Server installed at the same machine, or is it a different one?
    do you have limitations in your account?
    does the hoster insert advertisment into the pages?
    happy flashing
    8)
    Ronald