#!/usr/local/bin/perl -wT use CGI ":standard"; use CGI::Carp "fatalsToBrowser"; use lib "./"; use dustInformation; #use Mail::Sendmail; #couldn't find Email::Valid on the system, that's #why there is a regexp expression in there #collect the users name and email before they download #the grams models so that we can send them updates $query = new CGI; #attempting to untaint the users name for saving later my($firstname)=$query->param('firstname'); my($lastname)=$query->param('lastname'); my($emailaddress)=$query->param('emailaddress'); print header; # it is important to check the validity of the email address # supplied by the user both to catch genuine (mis-)typing errors # but also to avoid exploitation by malicious users who could # pass arbitrary strings to sendmail through the "send_to" # CGI parameter - including whole email messages, the below regexp # does a check for a specificly formed valid email address if ($emailaddress =~ m/(^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$)/) { my($emailaddress) = $1; print "$emailaddress is valid
"; } else { print "$emailaddress is invalid
"; exit; } #subscribe them to the grams@stsci.edu email list #by issuing an email to majordomo. also update a text #file with the list of users #removing the automatic sendmail for the time being, I'm not sure it's available #on our server. So someone will have to check the text file every once in a while #and make sure people are subscribed. Or, maybe we could set a cron job to do it. $ENV{"PATH"} = "/usr/lib/"; #done to untaint the sendmail command my $sendmail = "/usr/lib/sendmail -t "; my $content = "subscribe grams\@stsci.edu $emailaddress\n"; my $send_to = "sundar\@asiaa.sinica.edu.tw\n"; my $from = "sosey\@stsci.edu\n"; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; $year += 1900; $mon++; #untaint the user input if ($firstname =~ m/([a-zA-Z]$)/) { my($firstname) = $1; } if ($lastname =~ m/([a-zA-Z]$)/){ my($lastname) = $1; } #my $file = "subscribers.txt"; #open (FILE, ">>$file") or die "Cannot open $file: $!"; #print FILE "$lastname, $firstname, $emailaddress, $mon/$mday/$year $hour:$min, $ENV{HTTP_REFERER}, $ENV{HTTP_USER_AGENT}, $ENV{REMOTE_HOST}\n\n"; #close(FILE); open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!"; print SENDMAIL "To: $send_to\n"; print SENDMAIL "From: $from\n"; print SENDMAIL $content; close(SENDMAIL); print <
Subscription to the GRAMS email list will be sent to you.

Download models now

HTML print end_html;