// Last Modified: 11/05/2005//// You may freely use, modify, and distribute this script.////////////////////////////////////////////////////////////////// SET THE VARIABLES//// filename of guestbook$guestbook_filename = "guestbook.html";// text of error message$error_msg = "

Error: Your submission failed validation.

";//// VALIDATE SUBMISSION//// do not accept a submission if:// (1) there are no comments// (2) the comments contain a Web address// (3) the name is longer than 40 characters// (4) the city is longer than 30 characters// (5) the city and state are identicalif ($comments == "" || ereg("http://", $comments) || ereg("www.", $comments) || ereg("/", $entry, $guestbook_data);// create a single variable from guestbook array$guestbook_data = join("", $guestbook_data);// open guestbook file for writing only$guestbook = fopen($guestbook_filename, "w");// write new guestbook data to guestbook filefputs($guestbook, $updatedBook);// close guestbook filefclose($guestbook);// send user back to guestbookheader("Location: $guestbook_filename");?>