1257 Uncaught exception from user code: 1258 syntax error at /home/dhoss/public_html/dynamic/book/book.cgi line 176, near "## #!/usr/bin/perl -w ################################################################### # ScapeBook version 1.0 # Date written: 3/30/03 (completed as final production on this date # Freeware compliments of http://dreamscapedesigns.cjb.net # Written and designed by Dhoss of DreamScape designs # This is freeware, however, if you choose to use this script, please take # notice of the appending disclaimer and also keep this copyright intact. # Email any and ALL problems to dhoss@dreamscapedesigns.cjb.net, or fill out # our buglog form @ our website (http://dreamscapedesigns.cjb.net/bugs.pl?action=ScapeBook) # Questons? Comments? Please email me at dhoss@dreamscapedesigns.cjb.net! # Have fun with your new guestbook!!! # -Dhoss #################################################################### # DISCLAIMER # Copyright Dreamscape designs 2003 version 1.0 # All problems arising from the use of this book that may cause # damage or other undesired performances are not a liabity of # Dreamscape designs, Devin J. Austin, or any other Dreamscape affiliates. # This copyright must remain intact. # Kindly ask for permission to sell the code for this guestbook , as I will # gladly say yes. Written consent must be obtained before selling this code! #################################################################### # Note to users: # view readme.txt for extensive FAQ, installation, configuration, and tutorial help ##################################################################### use CGI qw(-compile :all); use strict; use diagnostics; #Comment out after first test drive!!! #use CGI::Carp qw(warningsToBrowser fatalsToBrowser); #Variables my $q = new CGI(); my $action = $q->param('action'); my $data_file = "data/data.dat"; my $t = $q->param('t'); #my $ipLogFile = "data/ip.dat"; my $page_title = "ScapeBook v1.0 --http://dreamscape.cjb.net--"; my $form_validate_script = "validate/form_data.js"; my $ipLog = 0; #the following is all the arrays that are used in this script #associative array for images #img tag will now look like this: # ############################################################## my %images = ('logo', '../../img/logo.gif', 'submit', 'img/submit.jpg', 'addTo', 'img/add.jpg', 'adminBook', 'img/adminBook.jpg', 'previewEntry', 'img/prev.jpg', 'linkLogo', 'img/lilLogo.jpg', 'bg', 'img/bg.jpg'); #associative array for URLS my %urls = ('DreamScape', 'http://dreamscape.cjb.net', 'admin', 'admin/admin.pl', 'sign_book', 'book.cgi?action=sign', 'preview_entry', 'book.cgi?action=preview', 'view_entries', 'book.cgi?action=view_entry', 'report_bug', 'http://dreamscape.cjb.net/bugs.cgi?action=ScapeBook', 'page_style_sheet', 'css/book.css', 'cgi_url', 'book.cgi'); # Initialize list of months my @month = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); #Okay, not an array, but it goes with the date procedure # Get the date and time information my ($Seconds, $Minutes, $Hours, $DayInMonth, $Month, $ShortYear, $DayOfWeek, $DayOfYear, $IsDST); ($Seconds, $Minutes, $Hours, $DayInMonth, $Month, $ShortYear, $DayOfWeek, $DayOfYear, $IsDST) = localtime(time); # Fix the year to keep it Y2K compliant, as described in 'Perl and Y2K' # http://perl.about.com/library/weekly/aa070299.htm my $Year = $ShortYear + 1900; my $EntryDate = "$month[$Month] $DayInMonth, $Year"; ################################################# #init subs for page $| = 1; main(); sub main { write_to_file() if ($q->param('do_it') eq 's'); print_page() if ($q->param('action') eq ''); print_form() if ($action eq 'sign'); } if ($action eq 'view_entry') { print_main(); } sub print_main { print qq( Guestbook Entries

Guestbook entries:); show_book_entries(); print qq(
Sign this book | Back to the guestbook main page
~; create_footer(); print qq( ); } ################################################ sub print_page{ print qq( $page_title

Welcome to my guestbook! I have worked very hard and put all of my perl knowledge into this, so I hope you like it!

-Dhoss

Guestbook functions:


); create_footer(); print qq) ); sub print_form { print qq( Sign the guestbook!

Your Name: 
Your Email: 
Your Country: 
Your state/province/territory: 
Your city: 
Rate this site: 
Your comments:
 
); create_footer(); print qq( ); } sub show_book_entries { open (FILE, "$data_file") || die "Can't open file:$!"; my @arr = ; if (@arr eq '') { print qq~(No entries)~; } else { foreach my $stuff (@arr){ print "$stuff", $q->br, } } } close(FILE); if ($action eq 'sign') { print_form; } } sub dienice { my($msg) = @_; create_header("Error"); print qq(

Error

\n ); print qq( $msg\n ); create_footer(); exit; } sub create_footer { print qq(
[back to the main page]
© Copyright 2003 DreamScape Designs. All rights reserved. URL: http://dreamscapedesigns.cjb.net ); print $q->end_html; } my $has_header = 0; sub create_header { my ($page_title) = @_; if ($has_header == 0) { print $q->header; print $q->start_html( -title=>$page_title ); $has_header = 1; } } sub write_to_file { #uncomment this line and the line below that read flock (BOOK, LOCK_EX) or dienice("Can't get an exclusive lock on $dataFile: $!"); #see read me for details. #use Fcntl qw{ :flock }; #I opted to use the "?:" conditional operator instead of the traditional #if (...){} else {...} statement. #Saved alot of time and code, especially after I've written once before! #This code segment provided graciously by Chas at webhostingtalk.com open BOOK, "<$data_file" or dienice("Could read open $data_file. Reason: $!"); #flock (BOOK, LOCK_EX) or dienice("Can't get an exclusive lock on $dataFile: $!"); read (BOOK, my $book, -s BOOK); close BOOK; open BOOK, ">$data_file" or dienice("Could write open $data_file. Reason: $!"); # flock (BOOK, LOCK_EX) or dienice("Can't get an exclusive lock on $dataFile: $!"); print BOOK "\n"; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK "" : print BOOK "Email:  (No email given)"; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK "" : print BOOK "City: (No city provided)"; print BOOK ""; print BOOK ""; print BOOK "" : print BOOK "City: (No city provided)\n"; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK ""; print BOOK "
"; print BOOK "Signed on: $EntryDate"; print BOOK "
"; print BOOK "Name:" . $q->param('name') ; print BOOK "
"; my $m = $q->param('email') ? print BOOK "Email:  param('email').">".$q->param('email')."
"; print BOOK "Country:" . $q->param('country') . "
"; my $n = $q->param('state') ? print BOOK "State/Province/Territory: " . $q->param('state') . "
"; my $o = $q->param('city') ? print BOOK "City: " . $q->param('city') . "
"; print BOOK "Site rating: " . $q->param('rate') . "
"; print BOOK "Comments:
"; print BOOK $q->param('comments'); print BOOK "
"; print BOOK "
\n\n"; print BOOK ""; print BOOK $book; } close(BOOK); print_thanks() if ($t eq 'sign_success'); sub print_thanks { print qq( Thanks!
Thank you for signing my guestbook:
Here is what you entered:

); print "Name:" . $q->param('name') . "
\n"; my $mo = $q->param('email') ? print "Email:" . $q->param('email')."
\n" : print "Email:  (No email given)
\n"; print "Country:" . $q->param('country') . "
\n"; my $no = $q->param('state') ? print "State/Province/Territory: " . $q->param('state') . "
\n" : print "Country: (No country provided)"; my $oo = $q->param('city') ? print "Citry: " . $q->param('city') . "
\n" : print "City: (No city provided)"; print "Site rating: " . $q->param('rate') . "
\n"; print "Comments:
\n"; print $q->param('comments') . "
\n"; print qq(

View your entry); create_footer(); print qq( ); }