#! /Perl/bin/perl $|=1; use diagnostics; use vars; use CGI qw(:standard); use Win32::OLE; $q = new CGI; # The following accepts the data from the form print"Content-type: text/html\n\n"; $LastName = param('LastName'); # $FirstName = param('FirstName'); # $MiddleName = param('MiddleName'); # $Email_address = param('Email_address'); # $Area = param('Area'); # $Prefix = param('Prefix'); # $Number = param('Number'); # $Address = param('Address'); # $City = param('City'); # $State = param('State'); # $Zip = param('Zip'); # $Code = param('Code'); # $Grad = param('Grad'); # $HighSchool = param('HighSchool'); # $tmpfile = "../../Temp/$$.htm"; $dir = "../../Temp/RRX"; $dirfile = ""; $filexist = 0; @dirfiles = (); $file = "seminar.txt"; $Phone = join('-',$Area,$Prefix,$Number); @seminarfile = join('^',$LastName,$FirstName,$MiddleName,$Email_address, $Phone,$Address,$City,$State,$Zip,$Code,$Grad,$HighSchool); ############# check to see if seminar.txt exists ############################## opendir(DIR, "$dir") || die "Can't open $dir: $!\n"; @dirfiles = readdir DIR; closedir(DIR); foreach $dirfile(@dirfiles) { if($dirfile eq $file){$filexist = "1"} } if($Grad == "2004"){ #The following creates the Thank You page display print start_html('Thank You'); print start_form(); print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "





"; print "

"; print "
Back to USAFA










"; print "
UNITED STATES AIR FORCE"; print " ACADEMY

"; print "


Summer Seminar \ \;'03  Information Request
"; print "Thank you $FirstName $LastName for your request.


"; print "

"; print "Only High School Juniors may apply

"; print "

"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
\*Last Name\ \;\*First NameMiddle Name\*E-mail Address
Home Phone
$LastName
$FirstName
$MiddleName
$Email_address
$Area - $Prefix - $Number

"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
\*Mailing Address\*City\*State or"; print " Country\*Zip\ \;Code
$Address
$City
$State
"; print "$Zip
"; print "High School ETS Code
\*"; print "Year of Graduation
\*"; print "High School Name
"; print "$Code
"; print "$Grad
$HighSchool

"; print "If you are home schooled, enter \"000000\" as your school code.
"; print "


"; print "

\ \;Privacy and Security Notice

"; print "

"; print "
"; print "USAFA/RRI
"; print "
"; print ""; print ""; print ""; print ""; print "

"; print end_form(); print end_html(); add(); email_msg(); send_win_mail(); } ############# sends mail to persons ########################################## sub send_win_mail { my $from = $q->param('Email_address'); my $to = ("$Email_address"); my $subject = qq(Summer Seminar '04 Information Request); my $date = localtime(time); my $mailbody = "$FirstName $LastName submitted an Summer Seminar Application Request on $date: \n\n"; my $AttachFile = "$tmpfile"; my $objMail = Win32::OLE->new("CDONTS.Newmail"); $objMail->Send($from,$to,$subject,$mailbody,$AttachFile); undef $objMail; unlink($tmpfile) || die "Can't delete $tmpfile: $!"; # Deletes the file created in /tmp/html exit(0); } sub email_msg { open(OUT, ">$tmpfile") || die "Can't write $tmpfile: $!\n "; print OUT "test"; close(OUT); } ################# creates new file or adds to existing file ############### sub add{ if($filexist == 1) { open(IN, "< $dir/$file") or die "Can't open input file $file: $!\n"; chomp(@filearray = ); close(IN); push(@filearray, @seminarfile); } elsif($filexist == 0) {push(@filearray, @seminarfile)} open(OUT, "> $dir/$file") or die "Can't write to $file: $!\n"; foreach $line(@filearray) { chomp $line; print OUT "$line\n"; } close(OUT); } #If applicant does not meet criteria print start_html('Wrong Grad Year'); print start_form(); print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "





"; print "

"; print "
Back to USAFA





"; print "





"; print "
"; print "UNITED STATES AIR FORCE ACADEMY
"; print "
"; print "



"; print "



"; print "At the present time $FirstName $LastName you do not meet
"; print "Summer Seminar Request criteria."; print "
You are only allowed to request information if you"; print "
are a JUNIOR in High School.
"; print " Thank You.

"; print "






"; print ""; print "
"; print ""; print ""; print ""; print ""; print "

"; print end_form(); print end_html(); exit(0);