#!/usr/bin/perl # # classifieds.pl # version 980901 # copyright 1997-1998 by bo larsson # all rights reserved # # this CGI program will allow you to maintain a set of categorized # classified advertisements. It has the ability to either display or # add classifieds. # # $the_path should be set to where the text files that will contain # the classifieds are stored. # # bugs or feedback to bliss@seagull.net # for information on how to use, visit http://www.seagull.net/bliss/ $the_path = "/home/bliss/web/pclassifieds"; # Get the input and strip off all unwanted characters read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Store the matching name and value pairs foreach (split(/&/,$buffer)) { ($NAM, $VAL) = split(/=/, $_); $VAL =~ s/\+/ /g; $VAL =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg; $DATA{$NAM} = $VAL; } # Grab necessary variables $returnURL = $DATA{'returnURL'}; $value = $DATA{'value'}; $category = $DATA{'category'}; $user_email = $DATA{'user_email'}; $user_name = $DATA{'user_name'}; $message = $DATA{'message'}; $message =~ s/\n/ /g; print "Content-type: text/html\n\n"; # Check that category is a plain file name to prevent user # from supplying things like ";cat /etc/passwd |" $category =~ /^[\w-]+$/ || die "Invalid category given \"$category\""; if ($value eq "Display") { print "$category
\n"; print "
Send inquiries to: $name | "; print "$msg | "; print "
\n"; } } else { print "The option you selected doesn't exist. How did that happen?
\n"; } print "
"; print "Return to Classifieds"; print "