#!/usr/local/bin/perl # # Author: Kang SoonLai # Name: add-job v1.1 # Date: Some where in June 1995 # Last Updated: Jan 29 1996 # Oct 6 1996 v1.1 # # write the content to both the stdout and a temp file, so that the user # can view the content and decide whether to post the job and write the # file. write-job will be called if wanna post it. # ################################################################################ # define file to be edited. $tempfile = "/users/skang/public_html/experiment/job.html"; # define URLs $formhtml = "/~skang/experiment/jobform.html"; $cgibin = "/~skang/cgi-bin"; # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); $good = 0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). $value =~ s/~!/ ~!/g; # Uncomment for debugging purposes #print "Setting $name to $value
";
$info{$name} = $value;
if ($value) {
$good++;
}
}
if ($good > 3) {
# create a temp file for the job
open(DATA, "> $tempfile") || die "Can't open $tempfile!\n";
print DATA<$info{title}
Duties
Qualification
Preferred Qualification
Starting Date
Length of Employment
Wage Range
Application Deadline
Application Procedure
EOF
;
close DATA;
# print the preview on the screen.
print <$info{title}
Duties
Qualification
Preferred Qualification
Starting Date
Length of Employment
Wage Range
Application Deadline
Application Procedure
EOF
;
$info{title} =~ s/ /_/g;
print <
You can either press the";
print " BACK button on the browser or";
print " This to go back.";
}