#!/usr/local/bin/perl sub ReadParse { local (*in) = @_ if @_; local ($i, $key, $val); if ( $ENV{'REQUEST_METHOD'} eq "GET" ) { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } else { $in = ( grep( !/^-/, @ARGV )) [0]; $in =~ s/\\&/&/g; } @in = split(/&/,$in); foreach $i (0 .. $#in) { # Convert plus's to spaces $in[$i] =~ s/\+/ /g; # Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; # Associate key and value. \0 is the multiple separator $in{$key} .= "\0" if (defined($in{$key})); $in{$key} .= $val; } return length($in); } &ReadParse(*FORM); open(TOP, "/data/sites/98500/uhnd.com/www/1.txt") or die "$!"; @top = ; close TOP; open(BOTTOM, "/data/sites/98500/uhnd.com/www/2.txt") or die "$!"; @bottom = ; close BOTTOM; if($FORM{'name'} eq '') { &error(name); } if($FORM{'email'} eq '') { &error(email); } if($FORM{'freq'} eq '') { &error(freq); } if($FORM{'experience'} eq '') { &error(experience); } if($FORM{'sport'} eq '') { &error(sport); } if($FORM{'email'} ne $FORM{'email2'}) { &error(badmatch); } #### Email Info to Webmaster open(MAIL, "|/usr/sbin/sendmail -t"); print MAIL "Name: yay\n"; print MAIL "To: webmaster\@uhnd.com \n"; print MAIL "From: $FORM{'email'}\n"; print MAIL "Subject: UHND.com Volunteer Writing \n"; print MAIL "\n"; print MAIL "Name: $FORM{'name'}\n"; print MAIL "Email: $FORM{'email'}\n"; print MAIL "Username: $FORM{'username'} \n"; print MAIL "Password: $FORM{'password'} \n"; print MAIL "Frequency: $FORM{'freq'} \n"; print MAIL "Experience: $FORM{'experience'}\n"; print MAIL "Preferred topic: $FORM{'sport'}\n"; print MAIL "Comments: $FORM{'comments'}\n"; close MAIL; #### Email Confirmation to User $message = <<"ENCODING"; ### SET MESSAGE $FORM{'name'}, We appreciate your interest. Here's how it all works. We start by having our writers submit topics they are interested in working on to us via email at: Kyle\@uhnd.com After a topic is submitted and we approve, you may begin writing. When the piece is completed, just send it back to us via email (same address), and we'll proofread. We'll go ahead and fix spelling/grammatical errors, but if there's a problem with the structure, we'll ask the writer to make the appropriate changes. When the article is up to par, we feature it on the site. As a general rule, we frown upon extremely negative articles, and will not post these. This is a fansite after all. If you're critical of the team and want to write an editorial, that's perfectly okay. However, we expect criticism to be constructive, and articles shouldn't take cheap shots at anyone. Other than that, you have free reign. Understanding that this is a volunteer job, we give you a lot of space to do what you'd like. You can set your own timeline and topics, so long as you give us an idea of what's happening, and follow up on that. We can't post outdated material if you send something much later than expected. If you'd prefer to be assigned topics, or be given suggestions, you can signup on our UHND.com Writer's Email List, located at this link: http://www.uhnd.com/writersmailing.shtml Joining this list is completely optional, and you can leave it whenever you'd like, using the same link. Just note this email list has been less than active over the past year. That's it. If you're ready to start, just send us your topic first, so we can review it. This is very important, because we can't guarantee we'll post an article sent to us that hasn't received prior approval. If you have any further questions, don't hesitate to contact us. Simply reply to this email. Thanks for your interest, Kyle Kyle\@uhnd.com http://www.uhnd.com ENCODING open(MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $FORM{'email'} \n"; print MAIL "From: webmaster\@uhnd.com\n"; print MAIL "Subject: UHND.com Volunteer Writing Confirmation \n"; print MAIL "\n"; print MAIL "The following email is in response to your expressed interest in the volunteer writing program at UHND.com\n"; print MAIL "\n$message\n"; print MAIL "---------------------------\n"; print MAIL "Below is the information you provided: \n\n"; print MAIL "Name: $FORM{'name'}\n"; print MAIL "Email: $FORM{'email'}\n"; print MAIL "Username: $FORM{'username'} \n"; print MAIL "Password: $FORM{'password'} \n"; print MAIL "Frequency: $FORM{'freq'} \n"; print MAIL "Experience: $FORM{'experience'}\n"; print MAIL "Preferred topic: $FORM{'sport'}\n"; print MAIL "Comments: $FORM{'comments'}\n"; print MAIL "---------------------------\n"; close MAIL; ##### Confirmation Page print "Content-type: text/html\n\n"; print <<"ENCODING"; @top

Your form has been submitted.

A confirmation email with further instructions is on its way to you. Feel free to contact webmaster\@uhnd.com with any questions. Thanks for your interest.


@bottom ENCODING exit; sub error { $error_msg = $_[0]; if ($error_msg eq 'name') { $msg = 'The Name field was left blank.'; } if ($error_msg eq 'email') { $msg = 'The Email Address field was left blank.'; } if ($error_msg eq 'freq') { $msg = 'The Approximately how frequently you plan on writing field was left blank.'; } if ($error_msg eq 'experience') { $msg = 'The Previous writing experience field was left blank.'; } if ($error_msg eq 'sport') { $msg = 'The Preferred topic field was left blank.'; } if ($error_msg eq 'badmatch') { $msg = 'The email addresses you entered did not match.'; } print "Content-type: text/html\n\n"; print <<"ENCODING"; @top

There was a problem with your submittion.

$msg Hit the 'BACK' button on your browser to try again. Feel free to contact webmaster\@uhnd.com with any questions. Thanks for your interest.


@bottom ENCODING exit; }