#!/usr/bin/perl ################################################################################### # Aneip GuestBook ver 0.9b # COPYRIGHT NOTICE: # # Copyright 1999 Mohd Hanif Ibrahim. All Rights Reserved. # Đ1999 Mohd Hanif Ibrahim. ################################################################################### # This script was release as FReeware. # # By using this program you agree to indemnify me from any liability. # # Distributing the software and/or documentation with other products # (commercial or otherwise) or by other than electronic means without # my prior written permission is forbidden. # # http://aneip.hypermart.net/guestbook # #################################################################################### print "Content-type: text/html\n\n"; $mail_prog = '/usr/lib/sendmail' ; $datafail ='guestbook.dat'; # Guestbook data file $viewperpage = '5'; # Number of record to show per page $sendtosigner = '0'; # Send thanx email 1 = enable 0 = disable $sendtoadmin = '1'; # send email to admin when got new record $adminemail = 'andreas@cuteart.nu'; # admin email $sender = 'Cute Art Guestbook'; $gbadress = 'http://www.cuteart.nu/guestbook/guestbook.cgi'; @badwords = ("pussy","suck","fuck","fucking","knulla"); # put your list of badwords $LIFO = '1'; # 1 - Display last record first # 0 - Display first record first. require ('cgi-lib.cgi'); &ReadParse(*field); $nama = $field{'nama'} ; $email = $field{'email'} ; $hp = $field{'hp'} ; $urlhp = $field{'urlhp'} ; $lokasi = $field{'lokasi'} ; $komen = $field{'komen'} ; $ip = $field{'ip'} ; $date = $field{'date'} ; $masa = $field{'masa'} ; $page = $field{'page'}; if ($page eq '') { $page = '0'; } if ($field{'action'} eq 'form'){ &PrintForm; exit; } if ($field{'action'} eq 'preview'){ &preview; exit; } if ($field{'action'} eq 'Confirm and add to guestbook'){ &save; exit; } if ($field{'action'} eq '' || $field{'action'} eq 'display'){ &display; exit; } ############################################################ # Edit this section is you want to change the appearance # ############################################################ sub header { print ""; print ""; print ""; print "Guestbook"; print ""; print ""; print "\n"; print ""; print ""; print ""; print "|; print qq||; print qq|
"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
 IndexDrawingsMiscellaneousGuestbookContactLinks\"Music  
"; print ""; print ""; print "
"; print ""; print "
Guestbook
"; } sub footer { if ($field{'action'} eq 'form'){ } else { ################################################### # Mellan inlaggen och "This script..." # ################################################### print qq|
|; } ################################################### # Fran "This script..." och resten av sidan # ################################################### #print qq|
This script is based on the
Aneip Guestbook
|; print qq||; print qq|
|; print qq|
|; print qq|
|; print qq|All characters and all artwork within these pages are copyright 1998-2002 Andreas Larsson, unless otherwise stated. Please don´t alter them or put them on another website without my permission.|; print qq|
|; print qq||; print qq||; print qq||; print qq||; print qq||; print qq||; print qq||; print qq||; print qq|
 IndexDrawingsMiscellaneousGuestbookContactLinks\"Music  
|; print qq||; print qq||; print qq||; } #Print HTML form. Edit this to change the GUESTBOOK appearance. Make sure you #didn't change the field name or the script will not work. sub PrintRecord { $num--; print qq|

$num
$date
$masa

|; if ($email eq ''){ print qq|$nama
|; } else { print qq|$nama
|; } print qq|
$hp
$komen

$lokasi


|; } #################### #Print HTML form. Edit this to change the FORM appearance. Make sure you #didn't change the field name or the script will not work. sub PrintForm { &header; ##################################################### # Formularet - mellan rubriken och "This script..." # ##################################################### print qq|
|; print qq|

A
D
D

T
O

G
U
E
S
T
B
O
O
K

Please note that you are not allowed to use any HTML tags. Any and all will automatically be deleted from the form. Fields with a * cannot be left empty.

Name*
Email
Homepage Title
Homepage URL
Where are you from
Comment*
OBS: do not use any quotation marks!

OBS! If your message is a long one, you might want to take a copy of it before you send it, just in case something goes wrong...
|; ################################################## # Delen mellan formularet och "This script..." # ################################################## print qq|
|; print qq|
|; print qq|
Thanks for wanting to write in my guestbook ^_^ Please keep your language at a decent level, though, as I reserve the right to remove or re-write messages that I find unsuitable for minors.
Please try to keep your message on-topic, otherwise I will ignore or remove the message all together!
|; print qq|
|; print qq|
Back to the guestbook entries.
|; &footer; } ############################################################ # Edit above section if you want to change the appearance # ############################################################ sub display { &header; ################################################### # Delen mellan rubriken och inlaggen i gastboken # ################################################### #########################################################################################################print "
[ Sign GuestBook ]

"; print "
"; #print "[BILD PÅ MEI]"; print "
\"Mei"; print "
"; open ("data", "$datafail") || &CgiDie ("Cannot open Guestbook Database"); open ("a","count.txt")|| &CgiDie ("Cannot open count file"); $bil = ; $bil++; close (a); @data = ; if ($LIFO) { @data = reverse(@data); } close (data); foreach (@data) { ($num, $nama, $email, $hp, $urlhp, $lokasi, $komen, $ip, $date, $masa) = split ('[|]',$_); chop ($masa); $num++; if ($LIFO) { $anum = $bil-$num; $anum++; } else { $anum = $num; } #$d = ($page + 1) * $viewperpage; if ($anum > ($d-$viewperpage) && $anum <= $d) { #########################################################################################################&PrintRecord; } } #########################################################################################################print "
"; print "

"; print "The guestbook has been temporarily closed.

"; print "Since I haven't felt like drawing for some time, and there's no way saying when I will feel like drawing again, I have decided to temporarily close this guestbook. I really appreciate your kind and encouraging comments, but I can't help feeling bad about not being able to return your kindness with new artwork and updates. If and when I start to draw and update again, I will open this guestbook again too. I hope it won't be too long.

Thank you for your patience."; print "
"; if ($page ne '0'){ #########################################################################################################print "[
Previus<\/a>]"; } if ($d < $bil && $d ne ''){ #########################################################################################################print "[Next<\/a>]"; } #########################################################################################################print "
"; &footer; exit; } sub preview { $message = "" ; $found_err = "" ; ########################################################## # Ovre delen av "mellan" skarmen med delmeddelanden etc. # ########################################################## print ""; print ""; print ""; print "Guestbook"; print ""; print "\n"; print ""; print ""; print ""; print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
 IndexDrawingsMiscellaneousGuestbookContactLinks\"Music  
"; print ""; print ""; print "
"; print ""; print "
"; print "
Guestbook

"; $errmsg = "Please enter your name
" ; if ($nama eq "") { $message = $message.$errmsg ; $found_err = 1 ; } #$errmsg = "

Please enter a valid email address

\n" ; # #if (length($email) && ($email !~ /.+\@.+\..+/)) { # $message = $message.$errmsg ; # $found_err = 1 ; } $errmsg = "Please write something in the comment field
" ; if ($komen eq "") { $message = $message.$errmsg ; $found_err = 1 ; } if ($found_err eq "1") { $errmsg = "


Press the 'back' button in your browser to return to the guestbook form.






" ; $message = $message.$errmsg ; } ################################################################# # Nedre delen av "mellan" skarmen med delmeddelanden etc. (FEL) # ################################################################# $errmsg = "
" ; $message = $message.$errmsg ; $errmsg = "
" ; $message = $message.$errmsg ; $errmsg = "

All characters and all artwork within these pages are copyright 1998-2004 Andreas Larsson, unless otherwise stated. Please don´t alter them or put them on another website without my permission.
" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "" ; $message = $message.$errmsg ; $errmsg = "
 IndexDrawingsMiscellaneousGB&ForumContactLinks\"Music  
" ; $message = $message.$errmsg ; $errmsg = "
" ; $message = $message.$errmsg ; if ($found_err) { &PrintError; } &ckomen; $ip = $ENV{'REMOTE_ADDR'}; ($date,$masa) = &get_date; open ("a","count.txt") || &CgiDie ("Cannot open count file"); $num = ; $num += 2; close (a); &PrintRecord; print qq|

 


|; ###################################################################### # Nedre delen av "mellan" skarmen med delmeddelanden etc. (INGA FEL) # ###################################################################### #print " #
This script is based on the
Aneip Guestbook
#"; print ""; print " "; print ""; print ""; print "
"; print "
"; print "All characters and all artwork within these pages are copyright 1998-2002 Andreas Larsson, unless otherwise stated. Please don´t alter them or put them on another website without my permission."; print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
 IndexDrawingsMiscellaneousGuestbookContactLinks\"Music  
"; print ""; print ""; print ""; exit; } sub save { open ("a","count.txt")|| &CgiDie ("Cannot open Count file"); $num = ; close (a); $num++; $line = join('|', $num, $nama, $email, $hp, $urlhp, $lokasi, $komen, $ip, $date, $masa); $line .= "\n"; open ("data",">>$datafail")|| &CgiDie ("Cannot open Guestbook Database"); print data "$line"; close (data); open ("masuk",">count.txt")|| &CgiDie ("Cannot open count file"); print masuk "$num"; close (masuk); # send mail to admin if new entry if ($sendtoadmin) { $recip = $adminemail ; open (MAIL, "|$mail_prog -t") || &CgiDie ("Cannot open MAIL Program"); print MAIL "To: $recip\n"; print MAIL "From: $sender\n"; print MAIL "Subject: You have a new entry in your guestbook\n"; print MAIL "\n\n"; print MAIL "You have a new entry in your guestbook.\n" ; print MAIL "\n" ; print MAIL "$gbadress\n" ; print MAIL "\n\n"; close (MAIL); } if ($sendtosigner && email ne '') { $recip = $email ; open (MAIL, "|$mail_prog -t") || &CgiDie ("Cannot open MAIL program"); print MAIL "To: $recip\n"; print MAIL "From: $guesbookname\n"; print MAIL "Subject: Thank for signing our guestbook.\n"; print MAIL "\n\n"; print MAIL "Thank you for signing our guestbook.\n" ; print MAIL "\n\n"; close (MAIL); } &display; } # end form checking. Let's do the job sub ckomen { $komen =~ s//>/g; $komen =~ s/\cM//g; #$komen =~ s/\n\n/

/g; $komen =~ s/\n/
/g; # Remove any badword foreach (@badwords) { $komen =~ s/$_/****/gi; } } #get time and date in nice format sub get_date { local($date,$localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($hour < 10) { $hour = "0$hour"; } if ($mon < 10) { $mon = "0$mon"; } if ($mday < 10) { $mday = "0$mday"; } @months = ("January","February","March","April","May","June","July","August","September","October","November","December"); $year = $year + 1900; $localtime = "$hour\:$min\:$sec"; $date = "$mday "."$months[$mon]"." $year"; chop($date) if ($date =~ /\n$/); chop($local) if ($local =~ /\n$/); ($date,$localtime); } #sent thank you message to you signer # Print error message sub PrintError { print $message ; exit 0 ; return 1 ; }