#!/usr/local/bin/perl # ######################################################################### # # Perl Guestbook: By Ackbar # # ######################################################################### # # This is a simple guestbook script (configured specificly for # # http://rebeccasghost.cjb.net # # ######################################################################### # # This code is free and may be redistributed as you please as long as these # # comments remain. Otherwise you will be asked to remove it. (unless I say # # you can take credits out :) # # ######################################################################### # # all options (0 = no) (1 = yes) $datafile = "guests.dat"; # Where to guests info is stored :) $data_file = "datastore.dat"; # Where the options are stored. $template = "template.tmp"; # Stores the url of the template file :) $password = "password.psw"; # Stores the location of the password file. # Lets read off the settings open (FILE,"$data_file") || die("Can't Open $datafile - for input\n"); $data=; chop($data); ($email, $title, $toptable, $bottomtable, $toptext, $bottomtext, $gnumber, $reqemail, $reqname, $requrl, $reqwwwname, $reqfound, $reqcomments, $sendemail, $logip, $topbanner, $bannerwidth, $bannerheight, $banneralt, $viewgrx, $viewwidth, $viewheight, $viewalt, $signgrx, $signwidth, $signheight, $signalt)=split(/õ/,$data); close(FILE); sub Read_Request{ if ($ENV{'CONTENT_LENGTH'} > 0){ read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @fields = split (/&/, $buffer); } else { $_ = "$ENV{'QUERY_STRING'}"; @fields = split (/&/, $_); } foreach $field (@fields){ ($name, $value) = split (/=/, $field); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } } &Read_Request; open (PASSWRD, "$password") || die("Error opening the password file.\n"); $passstore=; close(PASSWRD); if ((length($FORM{password}) < 1) || $passstore ne $FORM{password}){ print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "$title\n"; print "\n"; print "
Make your own free website on Tripod.com
\n"; print "
\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "\n"; print "
"; print "Password:
\n"; print "\n"; print "
\n"; print "\n"; exit; } open (FILE,"$datafile") || die("Can't Open $datafile - for input!\n"); @LINES=; $SIZE=@LINES; $raw_data = ; close(FILE); open (FILED, "$template") || die("Could not open template file for input.\n"); @LINESD=; $SIZEIT=@LINESD; @LINESS=@LINESD; close(FILED); if ($FORM{min} && $FORM{max}){ $minnum = $FORM{min}; $maxnum = $FORM{max}; } else { $minnum = 0; $maxnum = $gnumber; } if ($maxnum > $SIZE){ $maxnum = $SIZE; } if ($minnum < 0){ $minnum = 0; } print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "$title\n"; print "\n"; print "\n"; print "
\n"; print "$banneralt
\n"; print "\n"; print "\n"; print ""; print "\n"; print "
\n"; print "$signalt\n"; print "\n"; print "$viewalt\n"; print "
Guests $minnum - $maxnum of $SIZE

\n"; print "
\n"; $linenum=0; open (FILES,"$datafile") || die("Can't Open $datafile - for input!\n"); $nextnum = ($minnum + $gnumber); if ($nextnum > $SIZE){ $nextnum = $SIZE; } for($f=$minnum;$f<$nextnum;$f++) { $linenum++; $guest = $LINES[$f]; chop($guests); ($name, $email, $url, $how, $age, $comments, $forowner, $ip)=split(/õ/,$guest); $ownerstr = "$comments
\n"; $ownerstr = "$ownerstr \n"; $ownerstr = "$ownerstr \n"; $ownerstr = "$ownerstr Password:
\n"; $ownerstr = "$ownerstr  \n"; $ownerstr = "$ownerstr \n"; $ownerstr = "$ownerstr \n"; $ownerstr = "$ownerstr
\n"; $ownerstr = "$ownerstr
\n"; @LINESD=@LINESS; for ($i=0;$i<=$SIZEIT;$i++){ $LINESD[$i] =~ s/:email/$email/ig; $LINESD[$i] =~ s/:name/$name/ig; $LINESD[$i] =~ s/:url/$url/ig; $LINESD[$i] =~ s/:wwwname/$age/ig; $LINESD[$i] =~ s/:comments/$ownerstr/ig; if ($logip eq '1'){ $LINESD[$i] =~ s/:ip/ - $ip/ig; } else { $LINESD[$i] =~ s/:ip//ig; } $LINESD[$i] =~ s/:how/$how/ig; $strng=$LINESD[$i]; print "$strng\n"; } print "\n"; print "\n"; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; $newmin1 = $minnum + $gnumber; $newmax1 = $maxnum + $gnumber; $newmin2 = $minnum - $gnumber; $newmax2 = $maxnum - $gnumber; print "\n"; print "\n"; print "

\n"; if ($newmin2 >= 0){ print "\n"; } print "

\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; if ($newmin1 <= $SIZE){ print "\n"; } print "
\n"; print "
\n"; print "
\n"; close(FILES); print "\n"; print "\n";