'); } if(!$_GET['name']) { $filename = $_GET['url']; $title = $_GET['title']; echo ('You forgot to enter a name!

'); } elseif(!$_GET['filename']) { echo ('Trouble! The script encountered an error. Wait a minute and try again, or contact the webmaster. '); } elseif(!$error) { echo $filename; $filename = $_GET['filename']; echo $filename; $title = $_GET['title']; $name = $_GET['name']; $comment = $_GET['comment']; //Database section! Add a new comment field to the film's slice of the database. //extract date $day = date(D); $date = date(j); $month = date(F); $hour = date(H); $minutes = date(i); $timestamp = "At ".$hour.":".$minutes." on ".$day.", ".$month." ".$date.", ".$name." wrote:"; $newcomment = $timestamp."\n
".$comment."\n
\n
"; print $newcomment."
"; } $db = @mysql_connect("mysql.csail.mit.edu","filmsai","filmsAI+3456") or die("Whoops! Couldn't connect to the database \ server. Try again in a minute or contact the webmaster."); @mysql_select_db("filmsAI",$db) or die("Whoops! Couldn't select database. Try again in a minute or contact the webmaster."); $oldpointer = @mysql_query("SELECT `pointer` FROM `comments` WHERE filename='$filename'"); $pointer = $oldpointer + 1; print $pointer; if ($pointer >= 999) {print "Too many comments in database, please send by email!";} else {$commentfield = sprintf("comment%03d",$pointer);} echo $commentfield; echo $commentfield; echo $newcomment; echo $pointer; echo $pointer; $filename=$filename; echo $filename; @mysql_query("UPDATE comments SET $commentfield='$newcomment',pointer='$pointer' WHERE filename='$filename'") or die("Whoops! The script failed to set the new comments. Try again in a minute or contact the webmaster."); $number = substr($filename,0,2); echo ('
Thanks for submitting your comments about "'.$title.'".
Return to the main page or go back to "; // $lastno = $resultno - 2; // for ($i = 1; $i <= $lastno; $i++) { // printf("comment%03s\n
", $i); // } // $newno = $resultno - 1; // $nextcommentname = sprintf("comment%03s\n
", $newno); // print $nextcommentname; ?>