#!/usr/local/bin/perl $testdir = 'c:/www/siteman/client/nyucfp/website/cfp20001'; $livedir = '/usr/local/ns-home/cfpweb'; $basehref = "http://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}"; $basehref =~ s/cgi\-bin\/[\x00-\xff]+//; $basehref =~ s/[\/]+$/\//; read (STDIN,$buffer,$ENV{CONTENT_LENGTH}); ($cmd,@param) = split(/\,/,$ENV{QUERY_STRING}); $out = "BULLETIN REQUEST

\n"; if ($param[0] eq 'submit') { @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $form{$name} = $value; } $reqdata = ""; $reqdata .= "\nBulletin Request\n\n"; $reqdata .= "\nFirst Name: $form{firstname}"; $reqdata .= "\nLast Name: $form{lastname}"; $reqdata .= "\nStreet Address: $form{address1}"; $reqdata .= "\nStreet Address 2: $form{address2}"; $reqdata .= "\nCity: $form{city}"; $reqdata .= "\nState: $form{state}"; $reqdata .= "\nZip Code: $form{zip1} $form{zip2}"; $reqdata .= "\nE-mail: $form{email}"; $reqdata .= "\nHome Phone: $form{homephone}"; $reqdata .= "\nWork Phone: $form{workphone}"; @reqdata1=($form{firstname},$form{lastname},$form{address1},$form{address2},$form{city},$form{state},$form{zip},$form{email}); $writeUIDC = 0; $maxDelay = 15; $binfo = ''; if ($form{bulletins} =~ /SCPS/) { replyMail("SCPS"); $writeUIDC = 1; $binfo .= 'WBUL '; $scpsuidc = "WBUL"; } if ($form{bulletins} =~ /ADSD/) { replyMail("Adult Undergraduate Degree"); $writeUIDC = 1; $binfo .= "ADSDWS "; $adsduidc = "ADSDWS"; } # if ($form{bulletins} =~ /WFTI/) { # replyMail("Fast-Track Intensives"); # $writeUIDC = 1; # $binfo .= "WFTI "; $wftiuidc = "WFTI"; # } if ($form{bulletins} =~ /MSDM/) { replyMail("MS Direct Marketing"); $writeUIDC = 1; $binfo .= "DMWBDM "; $ms1 = "DMWBDM"; } if ($form{bulletins} =~ /MSMS/) { replyMail("MS Management and Systems"); $writeUIDC = 1; $binfo .= "V1WBMS "; $ms2 = "V1WBMS"; } if ($form{bulletins} =~ /WEBU/) { replyMail("E-Business Brochure"); $writeUIDC = 1; $binfo .= "WEBU "; $ms9 .= "WEBU"; } if ($form{bulletins} =~ /MSTTM/) { replyMail("MS Travel and Tourism Management"); $writeUIDC = 1; $binfo .= "R6WBTT "; $ms3 = "R6WBTT"; } if ($form{bulletins} =~ /MSHIS/) { replyMail("MS Hospitality Industry Studies"); $writeUIDC = 1; $binfo .= "R7WBHS "; $ms4 = "R7WBHS"; } if ($form{bulletins} =~ /MSPub/) { replyMail("MS Publishing"); $writeUIDC = 1; $binfo .= "R9PUBWS "; $ms5 = "R9PUBWS"; } if ($form{bulletins} =~ /MSRE/) { replyMail("MS Real Estate"); $writeUIDC = 1; $binfo .= "R3WBMR "; $ms6 = "R3WBMR"; } if ($form{bulletins} =~ /APCRE/) { replyMail("Advanced Professional Certificate:Real Estate"); $writeUIDC = 1; $binfo .= "R4ACREWS"; $ms7 = "R4ACREWS"; } if ($form{bulletins} =~ /APCIT/) { replyMail("Advanced Professional Certificate:Information Technology"); $writeUIDC = 1; $binfo .= "V2WBIT "; $ms8 = "V2WBIT"; } if ($form{bulletins} =~ /Online/) { replyMail("On-line Courses"); $writeUIDC = 1; $binfo .= "WOLB "; $onlineuidc = "WOLB"; } if ($form{bulletins} =~ /short/) { delayWrite("/usr/local/docs/marketing/short/shortreq"); replyMail("Short Course"); } if ($form{bulletins} =~ /BSRL/) { sendMail("scps.sportsbs\@nyu.edu"); replyMail("B.S. Recreation & Leisure"); } if ($form{bulletins} =~ /BSCT/) { sendMail("scps.comtech\@nyu.edu"); replyMail("B.S. Communications Technologies"); } if ($form{bulletins} =~ /BSTT/) { sendMail("scps.bshosp\@nyu.edu"); replyMail("B.S. Travel & Tourism"); } if ($writeUIDC) { if ($param[1] eq 'domestic') { $form{homephone} =~ s/\D//g; $form{workphone} =~ s/\D//g; @firstname = split (//,$form{firstname}); @middleinit = split (//,$form{middleinit}); @lastname = split (//,$form{lastname}); @address1 = split (//,$form{address1}); @address2 = split (//,$form{address2}); @city = split (//,$form{city}); @state = split (//,$form{state}); @zip1 = split (//,$form{zip1}); if ($form{zip2} eq '0000') {$form{zip2} = ' ';} @zip2 = split (//,$form{zip2}); @country = split (//,$form{country}); @email = split (//,$form{email}); @homephone = split (//,$form{homephone}); @workphone = split (//,$form{workphone}); foreach $spot (0..17) {$bullinfo[$spot] = $firstname[$spot];} $bullinfo[18] = $middleinit[0]; foreach $spot (0..17) {$bullinfo[$spot + 19] = $lastname[$spot];} foreach $spot (0..29) {$bullinfo[$spot + 37] = $address1[$spot];} foreach $spot (0..29) {$bullinfo[$spot + 67] = $address2[$spot];} foreach $spot (0..17) {$bullinfo[$spot + 97] = $city[$spot];} foreach $spot (0..1) {$bullinfo[$spot + 115] = $state[$spot];} foreach $spot (0..4) {$bullinfo[$spot + 117] = $zip1[$spot];} foreach $spot (0..3) {$bullinfo[$spot + 122] = $zip2[$spot];} foreach $spot (0..49) {$bullinfo[$spot + 126] = $email[$spot];} foreach $spot (0..9) {$bullinfo[$spot + 176] = $homephone[$spot];} foreach $spot (0..9) {$bullinfo[$spot + 186] = $workphone[$spot];} foreach $spot (0..195) { if (($bullinfo[$spot] eq '') || ($bullinfo[$spot] eq '\n') || ($bullinfo[$spot] eq '\r')) { $bullinfo[$spot] = ' '; } } $bullinfo = join ('',@bullinfo); if ($form{hearabout} eq 'nkw3') {$hearabout = 'nkw3 ';} elsif ($form{hearabout} eq 'nytw') {$hearabout = 'nytw ';} elsif ($form{hearabout} eq 'otherw') {$hearabout = 'otherw';} elsif ($form{hearabout} eq 'newsw') {$hearabout = 'newsw ';} elsif ($form{hearabout} eq 'magw') {$hearabout = 'magw ';} elsif ($form{hearabout} eq 'outadw') {$hearabout = 'outadw';} @binfo = split(//,$binfo); for (0..87) { if ($binfo[$_] eq '') { $binfo[$_] = ' '; } } $binfo = join('',@binfo); $bullinfo .= "$binfo$hearabout$form{mcgheesub}"; $bullinfo =~ s/[\n\r]//g; open (UFILE,">>/usr/local/bullforms/uidcfile.dat"); print UFILE "$bullinfo\n"; close UFILE;print $!; } elsif ($param[1] eq 'inter') { $bullinfo = "\"$form{givenname}\""; foreach $fvalue ('familyname','businessname','title','address1','address2','address3','address4','city','state','zip1','country','email','hearabout') { $bullinfo .= ",\"$form{$fvalue}\""; } $bullinfo .= ",\"$scpsuidc\",\"$adsduidc\",\"$onlineuidc\",\"$ms1\",\"$ms2\",\"$ms3\",\"$ms4\",\"$ms5\",\"$ms6\",\"$ms7\",\"$ms8\",\"$ms9\",\"$form{mcgheesub}\""; open (UFILE,">>/usr/local/bullforms/interfile.dat"); print UFILE "$bullinfo\n"; close UFILE; } } $out .= "Thank you for your order. You will receive an e-mail confirmation within 24 hours. If you have any further questions, please call us at (212) 998-7080.

\n"; } elsif ($param[0] eq 'getzip') { @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\'/\'\'/g; $form{$name} = $value; if ($name eq "zipcode") {$zipcode = substr($value,0,5);} elsif ($name eq "mcgheesub") {$mcghee = $value;} else {$bulletins .= "$name;;";} } $foundzip = 0; $locale = 'inter'; if ($zipcode =~ /\d\d\d\d\d/) { open (ZFILE,"$testdir/datafiles/zip99.txt") || (ZFILE,"$livedir/datafiles/zip99.txt") || die("can't open zipcode file!"); while ($nextline = ) { if ($nextline =~ /$zipcode/) { @nextline = split (/\,/,$nextline); if ($nextline[2] =~ /$zipcode/) { $city = $nextline[0]; $city =~ s/\"//g; $citylist .= "

"; } else { $out .= "Your zip/postal was not found within the United States. Please fill in the following international request form or click HERE to re-try your zip code.
First Name:
Middle Initial:
Last Name:
Company/Apartment:
Street Address
City:
Please choose correct location from pull-down menu.
State/Province: Zip: -
E-mail:
Home Phone:
Work Phone:
\ "; } $out .= "
Given Name:
Family Name:
Business Name:
Title:
Street Address:
 
 
 
City:
State/Province:
Postal Code:
Country:
E-mail:
Where did you hear
about NYU SCPS?
"; } elsif ($param[0] eq '') { $out .= "

Please check the bulletins / brochures you would like to receive and enter your zip/postal code below.

SCPS Bulletin (To be mailed mid-July 2000)
Online Courses


Paul McGhee Undergraduate Degree Program for Adults


B.S. Hotel & Tourism Management
B.S. Sports Management & Leisure Studies
B.S. Communications Technologies

Zip/Postal Code:

"; } if (open(FILE,"$testdir/Study_Options$cmd.html") || open(FILE,"$livedir/Study_Options$cmd.html")) { while ($nextline = ) { $content .= $nextline; } close FILE; } else {die ("Cannot read index file!!!\n");} $content =~ s/studon\.gif/studoff\.gif/gi; $content =~ s/bulloff\.gif/bullon\.gif/gi; $content =~ s/location=\'/location=\'$basehref/g; $titlebase = "NYU Center for Publishing Bulletin Request<\/title> <base href=\"$basehref\"> "; $content =~ s/<title>[\x00-\xff]*<\/title>/$titlebase/i; $content =~ s/(<!--BEGIN_PAGE_TEXT-->)[\x00-\xff]*(<!--END_PAGE_TEXT-->)/$out/; $content =~ s/<!--BEGIN_NAVIGATION_MENU-->[\x00-\xff]*<!--END_NAVIGATION_MENU-->//; $content =~ s/<table width=\"200\"/<table width=\"90\"/; print "content-type: text/html $content "; sub delayWrite { local($file) = @_; $maxDelay = 5; $writeDelay = 0; $success = 0; $errors = ""; while ($writeDelay <= $maxDelay) { if (open (WFILE,">> $file")) { $success = write WFILE; close (WFILE); last; } else { $errors .= "$!\n"; } sleep ++$writeDelay; } if ($success == 0) { print "Unable to write bulletin request to $file:\n $errors"; } } sub sendMail { local($tomail) = @_; open (MAIL,"|/usr/sbin/sendmail -t -n -oi") || die "there was a problem with the call to sendmail"; print MAIL "To: $tomail\n"; print MAIL "From: $form{'firstname'} $form{'lastname'}\n"; print MAIL "Reply-To: $form{'email'}\n"; print MAIL "Subject: Bulletin Request\n\n"; print MAIL $reqdata; close(MAIL); } sub replyMail { local($bul_name) = @_; $mail_output = "Dear $form{firstname},\n\n"; $mail_output .= "The $bul_name bulletin/brochure will be sent to you when it becomes available.\n\n"; $mail_output .= "If you have any further questions, please call us at (212) 998-7080.\n\n"; $mail_output .= "Thank you for inquiring about NYU's School of Continuing and Professional Studies.\n"; open (MAIL,"|/usr/sbin/sendmail -t -n -oi") || die "there was a problem with the call to sendmail"; print MAIL "To: $form{email}\n"; print MAIL "From: NYU SCPS\n"; print MAIL "Reply-To: scpsinfo\@nyu.edu\n"; print MAIL "Subject: Bulletin Request\n\n"; print MAIL $mail_output; close(MAIL); } format WFILE = @<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<@<@<<<<@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $reqdata1[0], $reqdata1[1], $reqdata1[2], $reqdata1[3], $reqdata1[4], $reqdata1[5], $reqdata1[6], $reqdata1[7] .