#!/usr/local/bin/perl # ------------------------------------------------------------------------- # nominat.cgi - Based on the HTML file, C:\TRANSFER\NOMINAT.HTM # 1. Please make sure that the control structure is not altered. # 2. Save the edited file in text form. # 3. Transfer this file to the WWW server in ASCII mode. # 4. Set its protection to world read, execute (e.g. chmod 755 filename) # ------------------------------------------------------------------------- # (To see if the script works as intended: Type 'thisfile.pl < test', where test is a text file containing # the item identifiers as, Item1=string&Item2=string&Item3=... # Alternatively, you may like to install the CGI and HTML and test via the form.) # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # Start of the Perl script: # ------------------------------------------------------------------------- # Procedure to send mail sub do_mail { local($filename) = "/tmp/cf-$$"; open(TFILE,">$filename"); # >>>>> Start of User configurable section 1 of 2 >>>>> # The mail subject will be at the top of the message. print TFILE "************************************************\n"; print TFILE "Title: Happyclown Nomination Hall Submition Form\n"; print TFILE "************************************************\n\n"; if ($name ne "") { print TFILE "name: $name\n"; print TFILE "***************\n"; } if ($description ne "") { print TFILE "description:\n"; print TFILE "$description\n"; print TFILE "***************\n"; } if ($url ne "") { print TFILE "url: $url\n"; } close(TFILE); `/usr/bin/mail $mailreceiver < $filename`; $mailstatus = $?; unlink("$filename"); } # <<<<< End of User configurable section 1 of 2 <<<<< # >>>>> Do not alter anything in the following section >>>>> # convert %20 to a space and other %dd to a character sub reformat { local($tmp) = $_[0] ; $tmp =~ s/\+/ /g ; while ($tmp =~ /%([0-9A-Fa-f][0-9A-Fa-f])/) { $num = $1; $dec = hex($num); $chr = pack("c",$dec); $chr =~ s/&/and/g; # Replace if it is the & char. $tmp =~ s/%$num/$chr/g; } return($tmp); } # Main body of the script sub do_main { $cl = $ENV{'CONTENT_LENGTH'}; if ($cl > 0) { read(STDIN, $_, $cl); $_ .= "&"; # Append an & char so that the last item is not ignored $pquery = &reformat($_); while ($pquery =~ /name=([^&]*)&/) { if (!$name) { $name = $1; } else { $name = $name."\n ".$1; } $pquery =~ s/name=([^&]*)//; } $name = &reformat($name); while ($pquery =~ /description=([^&]*)&/) { if (!$description) { $description = $1; } else { $description = $description."\n ".$1; } $pquery =~ s/description=([^&]*)//; } $description = &reformat($description); while ($pquery =~ /url=([^&]*)&/) { if (!$url) { $url = $1; } else { $url = $url."\n ".$1; } $pquery =~ s/url=([^&]*)//; } $url = &reformat($url); # <<<<< Do not alter anything in the above section <<<<< # >>>>> Start of User configurable section 2 of 2 >>>>> print "Content-type: text/html\n\n"; print "
\n"; if ($name ne "") { print "Name: : $name\n"; print ""; print "......
\n"; } if ($description ne "") { print "Description:\n"; print ""; print "$description\n"; print ""; print "......
\n"; } if ($url ne "") { print "URL: : $url\n"; } print "
\n";
print ". . .
\n";
print "\n";
print "[Home]\n";
print "[Happyclown]\n";
print "[New]\n";
print "[Projects]\n";
print "[AVIC]\n";
print "[Links]
© Happyclown Inc.
\n"; } } # <<<<< End of User configurable section 2 of 2 <<<<< $misterwolf = `/bin/date`; $misterwolf =~ s/\n//g ; $mailreceiver = "bignose\@happyclown.com"; $|=1; eval '&do_main'; sleep(1); # ***** End of the Perl Script file. *****