Welcome, Guest. Please login or register.
Did you miss your activation email?
02/07/12, 08:25
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)
| | |-+  GUESTBOOK V2 ISSUES - HELP PLEASE
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: GUESTBOOK V2 ISSUES - HELP PLEASE  (Read 3582 times)
Mark Tara
Server what's that
*
Posts: 15


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


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

happy flashing
Cool
Ronald
Mark Tara
Server what's that
*
Posts: 15


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


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

happy flashing
Cool
Ronald
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6161


View Profile WWW Email
« Reply #4 on: 10/05/09, 03:47 »

I just visited your site.
Very nice artwork.

Your guestbook has an error:
Code:
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
Logged

happy flashing
Cool
Ronald
Mark Tara
Server what's that
*
Posts: 15


View Profile Email
« 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
Logged
Mark Tara
Server what's that
*
Posts: 15


View Profile Email
« 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);
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6161


View Profile WWW Email
« 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 Wink
« Last Edit: 10/05/09, 05:40 by Ronald Wernecke » Logged

happy flashing
Cool
Ronald
Mark Tara
Server what's that
*
Posts: 15


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


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

happy flashing
Cool
Ronald
Mark Tara
Server what's that
*
Posts: 15


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


Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6161


View Profile WWW Email
« Reply #11 on: 10/05/09, 09:21 »

there is no problem there anymore - the guestbook works.
Logged

happy flashing
Cool
Ronald
Mark Tara
Server what's that
*
Posts: 15


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


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

happy flashing
Cool
Ronald
Mark Tara
Server what's that
*
Posts: 15


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