#!/usr/bin/perl -w
use CGI;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime;
$time = sprintf( "%d-%02d-%02d %02d:%02d:%02d", 
	$year+1900, $mon+1, $mday, $hour, $min, $sec );
$q = new CGI();
$q->append(-name=>'tm',-value=>$time);
$fn = $q->param("fn");
$ln = $q->param("ln");
$in = $q->param("in");
$a1 = $q->param("a1");
$a2 = $q->param("a2");
$a3 = $q->param("a3");
$tl = $q->param("tl");
$em = $q->param("em");
$tm = $q->param("tm");
$tp = $q->param("tp");

print 
	$q->header,
 	$q->start_html('Your registration was successful'),
 	$q->h2('Your Registration Was Successful'),
 	$q->table(
 	 	$q->Tr( $q->td("Name:"),                       $q->td("$fn $ln")),
 		$q->Tr( $q->td("Institution:"),                $q->td($in)),
 		$q->Tr( $q->td({rowspan=>"3"},"Address:"),     $q->td($a1)),
 		$q->Tr(                                        $q->td($a2)),
 		$q->Tr(                                        $q->td($a3)),
 		$q->Tr( $q->td("Telephone:"),                  $q->td($tl)),
 		$q->Tr( $q->td("email:"),                      $q->td($em)),
        $q->Tr( $q->td("Topics of interest:"),         $q->td($tp))
 	),
	$q->end_html;
if( open( PART,  ">>participants.txt")){
	#print "open OK
"; $q->save(PART); close PART; open (PART,"participants.txt"); @parts=(); while( !eof(PART) ) { my $x = new CGI(PART); $s = $x->param("ln") . ", " . $x->param("fn") . " : " . $x->param("in"); push(@parts,$s); #print $s,"
"; } @parts = sort @parts; open(PLIST,">participants.html"); print PLIST "Participants\n"; print PLIST "

Participants

\n"; foreach $i (@parts) { print PLIST "$i
\n"; } print PLIST "\n"; close PLIST; $tmp_file = sprintf('%s%d%s','msg',time,'.tmp'); open( TMP, ">$tmp_file" ); print TMP "Subject: New Registration\n\n", "NEW REGISTRATION\n\n", "FirstName:$fn\n", "LastName:$ln\n", "Institution:$in\n", "Address1:$a1\n", "Address2:$a2\n", "Address3:$a3\n", "Telephone:$tl\n", "Email:$em\n", "Topics of Interest:$tp\n", "Time:$tm\n"; close TMP; system("mail hess\@urap.gsfc.nasa.gov,gopals\@fugee.gsfc.nasa.gov <$tmp_file"); }else{ print "cannot open file.
"; }