Welcome, Guest
  • Author Topic: GUESTBOOK V2 ISSUES - HELP PLEASE  (Read 4926 times)

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    GUESTBOOK V2 ISSUES - HELP PLEASE
    « on: 10/04/09, 23:46 »
    Hi - I am trying to get GBV-2 working

    I don't know anything about mySQL - I need help figuring out where stuff goes

    My server has PHP and mySQL

    I know what the following fields are

    database name:
    database user:
    database user pass:

    Is this code correct for the TXT page - do I need to put my info somewhere in this TXT page
    TXT PAGE CODE
    CREATE TABLE guestbook (
      ID int(5) NOT NULL auto_increment,
      name text NOT NULL,
      email text NOT NULL,
      comments text NOT NULL,
      time datetime NOT NULL default '0000-00-00 00:00:00',
      PRIMARY KEY  (ID)
    )TYPE=MyISAM COMMENT='GuestBook entries will be stored here' ;

    PHP CODE
    // Part One - Initiate a mySQL Database Connection
    // Database Connectivity Variables and other Variables
       $DBhost = "what goes here";   // Database Server
       $DBuser = "I fill in MY info here - correct";            // Database User
       $DBpass = "I fill in my info here - correct";            // Database Pass
       $DBName = "I fill in my info here correct";            // Database Name
       $table  = "what goes here";             // Database Table
       $numComments = 10;       // Number of Comments per page

    Please help

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #1 on: 10/05/09, 01:28 »
    Hi Tara,
    the hostname is given to you by your hosting provider.
    If the database engin is running on the same machine, it is usualy localhost.
    If you use the create table statement, your tablename is guestbook - you might name it different, if you like.
    happy flashing
    8)
    Ronald

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #2 on: 10/05/09, 03:31 »
    Hi Ronald
    thanks for getting to me - please bare wit hmy questions - I'm a real nubie - when you say
    "If the database engin is running on the same machine, it is usualy localhost."

    Does this mean if my HOST is running my DATABASE [wherever it maybe] then the "$DBhost = "localhost"; is that correct

    ALSO is the TXT page correct?

    ALSO do I need to change this code in the GBV2 PHP

     // Insert the data into the mysql table
           $sql = 'INSERT INTO ' . $table .
    TO THIS

     // Insert the data into the mysql table
           $sql = 'GuestBook' . $table .

    I've been working on the BGV1 file have I have it working - you can see it in the link below

    WORK IN PROGRESS
    http://www.marktara.com/markTaraFlash_new.html

    click on the WEB2.0 button

    Thanks in advance Ronald

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #3 on: 10/05/09, 03:41 »
    you have the choice - either change the entry in the $table variable, or enter the table name manualy.
    Doing both makes no sense.
    I hope, you got phpMyAdmin on your server.
    There you insert the text code into the SQL command window, after you are connected with your database.
    happy flashing
    8)
    Ronald

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #4 on: 10/05/09, 03:47 »
    I just visited your site.
    Very nice artwork.

    Your guestbook has an error:
    Code: [Select]
    syntax error, unexpected T_STRING in /home/marktara/public_html/GuestBook.php on line 93
    Check for semicolon at the end of each line - or typo in either line 93 or 92
    happy flashing
    8)
    Ronald

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #5 on: 10/05/09, 04:26 »
    GuestBook PHP
    is there an error here

    // Opens up the file declared above for reading
    92
    93   $fp    = fopen( $filename,"r");
    94   $Data    = fread($fp, 800000);
    95   fclose( $fp );

    I downloaded my phpmyAdmin but it's weird - it's not like a program where you launch a thing to load the the program - some web posts say I need APACHE but I'm not looking to be my own server I have a web server that has PHP AND mySQL - I use DREAMWEAVER CS3/FLASH CS3/I perfer AS2 do I need APACHE on my desktop

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #6 on: 10/05/09, 04:31 »
    This is the code fron the ORIGINAL GBV1

    // 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);

    THIS LINE HAS AN "i" SHOULD THE "i" be erased or do I need the put "i" in the other lines
    $Website    = eregi_replace("http://", "", $Website);

    $Website    = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #7 on: 10/05/09, 05:38 »
    i means - dont care about capital letters

    phpMyAdmin needs to be on your webserver.
    Most hosting provider offer it - if your provider does not, you have to upload and configure it at your webspace.
    But first, ask your provider, if he has it somewhere ;)
    « Last Edit: 10/05/09, 05:40 by Ronald Wernecke »
    happy flashing
    8)
    Ronald

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #8 on: 10/05/09, 08:43 »
    Hey Ron you mentioned I had an error round 92-93 I posted the code - so do I have an error



    Thanks

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #9 on: 10/05/09, 08:49 »
    the code you posted has no error.
    Soemtimes the error is in a line above.
    But in the meantime, the guestbook works.
    happy flashing
    8)
    Ronald

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #10 on: 10/05/09, 09:05 »
    THIS IS ALL THE CODE FOR THE GUESTBOOK V1 PHP

    <?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);
    $Comments    = eregi_replace("Shit", "****", $Comments);
    $Comments    = eregi_replace("Fuck", "****", $Comments);
    $Comments    = eregi_replace("Fucker", "****", $Comments);
    $Comments    = eregi_replace("Cock", "****", $Comments);
    $Comments    = eregi_replace("Cocksucker", "****", $Comments);
    $Comments    = eregi_replace("CockSucker", "****", $Comments);
    $Comments    = eregi_replace("Mother Fucker", "****", $Comments);
    $Comments    = eregi_replace("Mother-Fucker", "****", $Comments);
    $Comments    = eregi_replace("MotherFucker", "****", $Comments);
    $Comments    = eregi_replace("Fag", "****", $Comments);
    $Comments    = eregi_replace("Faggot", "****", $Comments);
    $Comments    = eregi_replace("Homo", "****", $Comments);
    $Comments    = eregi_replace("Gay", "****", $Comments);
    $Comments    = eregi_replace("Cunt", "****", $Comments);



    // 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 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>.:::.";
       
       $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></i><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;
          }
       }
    ?>



    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #11 on: 10/05/09, 09:21 »
    there is no problem there anymore - the guestbook works.
    happy flashing
    8)
    Ronald

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #12 on: 10/05/09, 10:54 »
    Hi Ron
    thanks for looking at my PHP code for GB V1

    I'm a bit confused about the GBV2 PHP

    When I find out what the Database Table name is from my WEBHOST do I need to enter it in this code as well

    $sql = 'INSERT INTO ' . $table . - so the 'INSERT INTO' would be replaced by the actual name I will get from my WEBHOST

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #13 on: 10/05/09, 10:57 »
    you can either enter it there, then you dont need the $table variable, or set it in the variable.
    doing both is useles, but does not harm.
    happy flashing
    8)
    Ronald

    Mark Tara

    • Server what's that
    • *
    • Posts: 15
      • View Profile
      • Email
    Re: GUESTBOOK V2 ISSUES - HELP PLEASE
    « Reply #14 on: 10/05/09, 11:44 »
    Hi Ron
    thanks for getting back to me when I get all the info from my webhost I'll start playing around with GBV2

    Thanks for all your help!