Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 07: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 freezes when ":" entered in any box
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Guestbook freezes when ":" entered in any box  (Read 1173 times)
ymd02
Server what's that
*
Posts: 1


View Profile
« on: 11/09/09, 16:10 »

I have a guestbook as an embedded video clip. I've spent a while getting everything to work right and now, finally, everything works EXCEPT - when a user enters a colon in any of the fields and hits submit, the guestbook hangs and nothing gets written into the .txt file.

I have all my code below. A quick note - I took out the "website" textfield and replaced "e-mail" with "city" for the purposes of my site. Feel free to check out the site - http://www.daylifeband.com

Here's the code. I appreciate any help!!! Thanks Smiley

<?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"];
$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);

// Remove slashes.
$Name       = stripslashes($Name);
$Email       = stripslashes($Email);
$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, F jS Y ( g:i 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 = "<b><u>Name:</u></b> <font size=\"-1\">$Name</font><br><b><u>Location:</u></b> <font size=\"-1\">$Email</font><br><b><u>Comments:</u></b> <font size=\"-1\">$Comments</font><br><font size=\"-1\"><b><u>Date:</u></b> <i>$Today</i></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;
      }
   }
?>
Logged
fresch
Server what's that
*
Posts: 5


View Profile Email
« Reply #1 on: 02/17/10, 10:59 »

i have the EXACT same problem, and also posted a thread about it!
Logged
Pages: [1] 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