#!/usr/local/bin/perl # # register # # Description # Process the form for the registration and abstract submission to the # Rome '98 conference on "Gamma-Ray Bursts in the Afterglow Era" # It is a "free" re-interpretation of the C-shell program used for the # Rome Symposium on BeppoSAX/RXTE results by Angelo Antonelli at SDC. # # Author: Mauro Orlandini # Revision: $Revision: 0.8 $ # Last Changed by: $Author: mauro $ # Last Changed on: $Date: 98/08/10 08:39:08 $ # # Initialization $rev = '$Revision: 0.8 $'; $rev =~ s/\$//g; $author = '$Author: mauro $'; $author =~ s/\$//g; $author = substr($author, 8); $upd_date = '$Date: 98/08/10 08:39:08 $'; $upd_date =~ s/\$//g; $upd_date = substr($upd_date, 6); # List of people that will receive the form submitted by any users $recipients = "orlandini@tesre.bo.cnr.it, romagrb@saxserver1.ias.rm.cnr.it"; #$recipients = "orlandini@tesre.bo.cnr.it"; # Mail program that is opened with a pipe (second pass) $mailprog = "/usr/lib/sendmail -t -oi -oem"; # Standard mail program $mail = "/usr/ucb/mail"; # Where to store the form files $Archive = "/usr/local/etc/httpd/htdocs/rome98/archive"; # You should not change anything below this line # For debugging purpose $debugging = 0; # Read and parse the form input &ReadParse; # Prepare the output file print &PrintHeader; if ($debugging) { # Print all the fields print &PrintVariables(%in); exit; } # Check to see if first or second pass goto SECONDPASS if $in{secondpass} =~ /true/; # Test if the compulsory fields are OK $in{email} =~ s/\s//g; if ($in{firstname} eq "" || $in{name} eq "" || $in{email} !~ /\@/) { &printReport; print "You must fill at least the First name, family name and e-mail fields"; &printReport_Close; } # Test if paying by cheque without bank and shipping date if ($in{payment} eq "cheque" && ($in{bank} eq "" || $in{shipping} eq "") ) { &printReport; print "You chose to pay by cheque, so you must fill the Bank name ", "and the shipping date of your cheque to the LOC"; &printReport_Close; } # Test if contribution without title and abstract if ($in{paper} =~ /y/ && (!$in{title} || !$in{abstract})) { &printReport; print "If you decided to contribute to the workshop
you must fill in\n"; print "BOTH the TITLE and ABSTRACT of your contribution"; &printReport_Close; } if ($in{paper} =~ /no/) { $in{contrib} = $in{kind} = $in{title} = $in{authors} = $in{abstract} = "none"; } elsif ($in{paper} =~ /yes/) { if ($in{poster} !~ /poster|oral/i) { &printReport; print "If you decided to contribute to the workshop
you must decide\n"; print "whether to present an Oral or Poster contribution"; &printReport_Close; } $in{contrib} = $in{paper}; $in{kind} = $in{poster}; $in{title} =~ s/[\cM]//g; $in{authors} =~ s/[\cM]//g; $in{abstract} =~ s/[\cM]//g; } # Counts words in the abstract $counts = split(" ", $in{abstract}); # Put everything in a temporary file $tmp = "/tmp/$$.symp"; $tmp_title = $in{title}; $tmp_authors = $in{authors}; $tmp_abs = $in{abstract}; open(TMP, ">$tmp") || die "Cannot open $tmp file: $!\n"; write TMP; close(TMP); # Here we prepare the confirmation form print "\n\nRegistration Form Confirmation\n"; print "\n"; print "

Gamma-Ray Bursts in the Afterglow Era

\n"; print "

Registration Form Confirmation

\n"; print "
\n"; print "This is the content of the registration form that ", "we are going to receive.
\n"; print "Please, check that all data are correct and confirm your registration\n"; print "by clicking on the confirmation button below.
\n"; print "If you wish to change something just go back to the previous form,\n"; print "correct the text and press SUBMIT again. Thank you.

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

First Name: $in{firstname}\n"; print "
Family Name: $in{name}\n"; print "
Institution: $in{institution}\n"; print "
Address: $in{address}\n"; print "
Zip-code: $in{zip}\n"; print "
City: $in{city}\n"; print "
Country: $in{country}\n"; print "
Telephone: $in{tel}\n"; print "
FAX: $in{fax}\n"; print "
e-mail: $in{email}

\n"; if ($in{payment} eq "transfer") { print "You chose to pay the registration fee by bank transfer

\n"; } else { print "You chose to pay the registration fee by a cheque issued to ", "Lidia Barbanera - Conto Gamma.
"; print "The bank issuing the cheque is $in{bank}\n"; print "and you shipped the cheque by courier on $in{shipping}

\n"; } if ($in{paper} =~ /yes/) { if ($in{poster} =~ /none/) { print "You did not specify the contribution type (oral/poster)!\n"; } else { print "You will present the following $in{poster} contribution:\n"; print "

Title:\n"; print "
$in{title}\n

\n"; if ($in{authors}) { print "

Authorship:\n"; print "
$in{authors}\n

\n"; } print "

Abstract:\n"; print "
$in{abstract}\n"; print "
WARNING!\n
Your abstract exceedes ", "100 words (it is $counts words)\nand it could be truncated in ", "the processing. Please trim it to the 100 words limit.\n" if $counts > 100; } } print "

\n"; print "\n"; print "

\n
\n

\n"; print "

This form has been generated by register $rev,", " last updated by $author on $upd_date
\n"; print "
\n", "\n"; print "Return to the Rome98 Page\n"; print "\n"; exit; ############################################################################## # # This section is performed for the second passage (authentication of # subscription) # ############################################################################## SECONDPASS: # Mail the acknowledge to the user open(MAIL, "| $mailprog") || die "Can't open mailprog $mailprog, stopped"; print MAIL <<"STOP"; To: $in{email} From: romagrb@saxserver1.ias.rm.cnr.it Subject: Registration to the Rome '98 Symposium Dear Dr $in{firstname} $in{name}, we have successfully received your registration form. Your e-mail has been added to our mailing list. Thank you for your interest. The Local Organizing Committee STOP close(MAIL) || die "An error occurred while processing your application.\n", "The program has logged your input and the operator will ", "contact you if he will not be able to rebuild your ", "record.\n

Thank you for your patience\n"; # Acknowledge the submitter &printReport; print "Your form has been successfully submitted.\n", "See you in Rome next November.\n"; print "


\n"; print "", "\n"; print "Return to the Rome98 Page\n"; print "\n"; # Mail the form to the LOC system("$mail -s \"Participation Form for $in{name} $in{firstname}\" $recipients < $in{file}"); # Store the file in the archive ($inname = $in{name}) =~ tr/A-Z/a-z/; $inname =~ s/\s//g; ($infirstname = $in{firstname}) =~ tr/A-Z/a-z/; $infirstname =~ s/\s//g; $newfile_name = $inname . "." . $infirstname . "." . $$; system("mv $in{file} $Archive/$newfile_name"); exit; format TMP = FIRSTNAME = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{firstname} FNAME = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{name} INSTITUTION = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{institution} ADDRESS = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{address} ZIP = @<<<<<<<<<< $in{zip} CITY = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{city} COUNTRY = @<<<<<<<<<<<<<<<<<<<<<<<< $in{country} PHONE = @<<<<<<<<<<<<<<<<<<< $in{tel} FAX = @<<<<<<<<<<<<<<<<<<< $in{fax} E-MAIL = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{email} DATE = late PAYMENT = @<<<<<<< $in{payment} BANK = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $in{bank} SHIPPING = @<<<<<<<<<<<<<<<<<<< $in{shipping} CONTRIB = @<<< $in{paper} KIND = @<<<<< $in{poster} TITLE = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tmp_title ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tmp_title AUTHORS = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tmp_authors ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tmp_authors ABSTRACT = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tmp_abs ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tmp_abs . sub printReport { print "\n\nRegistration Form Report\n"; print "\n"; print "

Gamma-Ray Bursts in the Afterglow Era

\n"; print "

Registration Form Report

\n"; } sub printReport_Close { print "\n

\n


\n"; print "", "\n"; print "Return to the Rome98 Registration Page\n"; print "\n"; exit; } ########################## Taken from cgi-lib.pl ############################ # Perl Routines to Manipulate CGI input # S.E.Brenner@bioc.cam.ac.uk # # Copyright 1993 Steven E. Brenner # Unpublished work. # Permission granted to use and modify this library so long as the # copyright above is maintained, modifications are documented, and # credit is given for any use of the library. # ReadParse # Reads in GET or POST data, converts it to unescaped text, and puts # one key=value in each member of the list "@in" # Also creates key/value pairs in %in, using '\0' to separate multiple # selections # If a variable-glob parameter (e.g., *cgi_input) is passed to ReadParse, # information is stored there, rather than in $in, @in, and %in. sub ReadParse { if (@_) { local (*in) = @_; } local ($i, $loc, $key, $val); # Read in text if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { for ($i = 0; $i < $ENV{'CONTENT_LENGTH'}; $i++) { $in .= getc; } } @in = split(/&/,$in); foreach $i (0 .. $#in) { # Convert plus's to spaces $in[$i] =~ s/\+/ /g; # Convert %XX from hex numbers to alphanumeric $in[$i] =~ s/%(..)/pack("c",hex($1))/ge; # Split into key and value. $loc = index($in[$i],"="); $key = substr($in[$i],0,$loc); $val = substr($in[$i],$loc+1); $in{$key} .= '\0' if (defined($in{$key})); # \0 is the multiple separator $in{$key} .= $val; } return 1; # just for fun } # PrintHeader # Returns the magic line which tells WWW that we're an HTML document sub PrintHeader { return "Content-type: text/html\n\n"; } # PrintVariables # Nicely formats variables in an associative array passed as a parameter # And returns the HTML string. sub PrintVariables { local (%in) = @_; local ($old, $out); $old = $*; $* =1; $output .= "
"; foreach $key (sort keys(%in)) { ($out = $in{$key}) =~ s/\n/
/g; $output .= "
$key
$out
"; } $output .= "
"; $* = $old; return $output; } # PrintVariablesShort # Nicely formats variables in an associative array passed as a parameter # Using one line per pair (unless value is multiline) # And returns the HTML string. sub PrintVariablesShort { local (%in) = @_; local ($old, $out); $old = $*; $* =1; foreach $key (sort keys(%in)) { if (($out = $in{$key}) =~ s/\n/
/g) { $output .= "
$key is
$out
"; } else { $output .= "$key is $out
"; } } $* = $old; return $output; }