#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser);
use strict;
no strict 'refs';
use CGI;
use Storable qw(retrieve nstore);
my $q = new CGI;
my %fields = $q->Vars;
my @REFID=split(/-=-/,$ENV{'QUERY_STRING'});
my $message;
my $datafile = "/home/httpd/vhosts/oakbox.com/cgi-bin/mail/blogfile.stor";
my $maincount = "12"; # how many articles on main page?
### Decision Tree
if($REFID[0] eq ""){
&mainpage;
}
if($REFID[0] eq "commentpost"){
&addcomment;
}
&article;
print "Something is wrong\n";
exit;
## Read and Write to object to Storable
sub reader {
my $object = retrieve($datafile);
return ($object);
}
sub addcomment {
# clean input
$fields{'fromname'} =~ tr/A-Z0-9a-z / /c;
$fields{'comment'} =~ tr/A-Z0-9a-z / /c;
# bail if blank
if($fields{'fromname'} eq "" || $fields{'comment'} eq ""){
$REFID[0] = $REFID[1];
&article;
}
# This doohickey reads reads the object
my $object = &reader;
# adds our comment to the appropriate article
$object->{$REFID[1]}->{comment}.= qq($fields{'fromname'} writes:
$fields{'comment'}
); } } $archives .= qq(
); } } my $banker = &archive; print "Content-type: text/html\n\n"; print "
Add your comment:
© Oakbox Productions