#!/usr/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; } else { $INPUT{$name} = $value; } } srand(); @names = ("Guest"); $emailnames{'guest\@guest.com'} = "Guest"; @emails = ("guest\@guest.com"); unless ($INPUT{'go_secondary'}) { &get_news; } else { &post_item; } exit; sub get_news { print "Content-type: text/html \n\n"; $dayshistory = $INPUT{'dayshistory'}; unless($dayshistory) { $dayshistory = 1000; } open(NEWS,"news.db"); flock(NEWS,2); @newspoststemp = ; close(NEWS); open(PREF,"prefs.$username.db"); flock(PREF,2); $last_view_time = ; close(PREF); open(PREF,">prefs.$username.db"); flock(PREF,2); print PREF time(); close(PREF); if ($username eq '') { $last_view_time = time(); } $unixtime = time(); $seconds_back = 86400 * $dayshistory; $time_threshold = $unixtime - $seconds_back; foreach $posted (@newspoststemp) { ($date, $name, $text) = split(/\|/,$posted); if ($date > $time_threshold) { push(@newsposts,$posted); } } @inspirational_lines = (""); $linenum = int(rand(($#inspirational_lines+1))); print <Talk for last $dayshistory days

$inspirational_lines[$linenum]

$extramessage
View past:
days
Name: End_Of_Getting_Post print <
Text:

End_Of_Getting_Post @days = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); @months = (January, February, March, April, May, June, July, August, September, October, November, December); @newsposts = reverse(@newsposts); foreach $postrawtext (@newsposts) { ($date, $name, $text) = split(/\|/,$postrawtext); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($date); $year += 1900; if ($hour == 0) { $hour = 12; } if ($hour > 12) { $hour -= 12; $ampm = "pm"; } else { $ampm = "am"; } if ($min < 10) { $min = "0" . $min; } $text =~ s/>:\)//ig; $text =~ s/:\)\)//ig; $text =~ s/:\)//ig; $text =~ s/:"\)//ig; $text =~ s/:D//ig; $text =~ s/:>//ig; $text =~ s/;\)//ig; $text =~ s/:p//ig; $text =~ s/:-p//ig; $text =~ s/B-\)//ig; $text =~ s/:\(\(//ig; $text =~ s/:\(//ig; $text =~ s/:x//ig; $text =~ s/:-\///ig; $text =~ s/:O//ig; $text =~ s/X-\(//ig; $text =~ s/:\|//ig; if ($date > $last_view_time) { $background = "pink"; } else { $background = "white"; } print ""; } print < End_Of_Getting_Post } sub post_item { $name = $INPUT{'name'}; $text = $INPUT{'text'}; $time = time(); if ($text eq '') { &get_news; exit; } $text =~ s/\|/\//g; $text =~ s/\cM//g; $text =~ s/\n/
/g; open(NEWS,">>news.db"); flock(NEWS,2); print NEWS "\n$time|$name|$text"; close(NEWS); $extramessage = "

your post has been added
"; &get_news; }

On $days[$wday], $months[$mon] $mday, $year, at $hour:$min$ampm, $name wrote:
$text