"; ######################################################### ### IF THE GUESTBOOK DB TABLE DOES NOT EXIST; CREATE IT ######################################################### $match = 0; $result = mysql_list_tables("$db_name"); $i = 0; while ($i < mysql_num_rows ($result)) { $tb_names[$i] = mysql_tablename ($result, $i); if ($tb_names[$i] == $gb_tablename) { $match = 1; } $i++; } if ($match != 1) { if (!eregi("UDT_", $gb_tablename)) { $gb_tablename = "UDT_"+$gb_tablename; // Tablename must start with UDT_ to be editable within DB Table Manager } mysql_db_query("$db_name","CREATE TABLE $gb_tablename ( PRIKEY INT NOT NULL AUTO_INCREMENT PRIMARY KEY, NAME CHAR(255), EMAIL CHAR(255), LOCATION CHAR(255), COMMENTS BLOB, FUTURE BLOB, AUTO_IMAGE CHAR(100), AUTO_SECURITY_AUTH CHAR(255) )"); } // End if Match != 1 // ---------------------------------------------------------------------------------------------- // -------------- Save the actual post to the data table // ---------------------------------------------------------------------------------------------- if ($EDIT_GUESTBOOK == "SAVE") { if (strlen($GUESTNAME) > 2 && strlen($GUESTEMAIL) > 2 && $GUESTCOMMENTS != "") { # Add slashes is magic quotes not on if( !get_magic_quotes_gpc() ) { $_POST['GUESTNAME'] = addslashes($_POST['GUESTNAME']); $_POST['GUESTEMAIL'] = addslashes($_POST['GUESTEMAIL']); $_POST['GUESTLOCATION'] = addslashes($_POST['GUESTLOCATION']); $_POST['GUESTCOMMENTS'] = addslashes($_POST['GUESTCOMMENTS']); } $today = date("F j,Y"); $insQry = "INSERT INTO ".$gb_tablename." VALUES('NULL','".$_POST['GUESTNAME']."','".$_POST['GUESTEMAIL']."','".$_POST['GUESTLOCATION']."','".$_POST['GUESTCOMMENTS']."','".$today."','NULL','NULL')"; # Run query and show specific error on failure if ( !mysql_query($insQry) ) { echo "MySQL Insert Failed!! --
".mysql_error(); } $EDIT_GUESTBOOK = ""; // Show Guestbook Now } else { $entry_err = 1; $EDIT_GUESTBOOK = "1"; // Redo Comments } } // End Save Routine // ---------------------------------------------------------------------------------------------- // -------------- Step 1: This is a normal entry to view the current guestbook ------------------ // ---------------------------------------------------------------------------------------------- if ($EDIT_GUESTBOOK == "") { echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; //echo "Guestbook"; echo " \n"; echo "
\n"; if ($pr != "") { echo " \n"; } else { echo " \n"; } echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; $result = mysql_query("SELECT * FROM $gb_tablename ORDER BY PRIKEY DESC"); $tcheck = mysql_num_rows($result); if ($tcheck > 0) { while ($row = mysql_fetch_array($result)) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$row['COMMENTS']."\n"; echo "
\n"; echo " ".$row['NAME']."
".$row['FUTURE']."
".$row['LOCATION']."\n"; echo "
\n"; echo "
"; } } else { echo "\n"; echo "\n"; echo "
There are currently no comments in the guestbook.

Please add your comments now!
\n"; } // End Make sure comments exist echo "
\n"; } // End Display Only // -------------------------------------------------------------------------------- // -------------- Step 2: Get other users comments now with form ------------------ // -------------------------------------------------------------------------------- if ($EDIT_GUESTBOOK == "1") { echo "\n"; echo "\n"; echo "
\n"; $err_show = ""; if ($entry_err == 1) { echo "You did not fill our all required fields. Please complete the form

\n"; $err_show = "*"; } echo "Enter you comments for the Guestbook below. Please fill out all fields.
Email addresses will not be shared with the public.

\n"; echo "
\n"; if ($pr != "") { echo "\n"; } else { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
$err_show Your Full Name:
$err_show Your Email Address:
Your Location (ie: Atlanta, Ga):
$err_show Your Comments:

\n"; echo "
\n"; echo "
\n"; } // End Edit Guestbook ?>