#!/usr/bin/perl

require "cgi-lib.pl";

print <<DONE;
Content-type: text/html

<TITLE>Kramer's Mailing List</TITLE>
<center><h1>Kramer's Mailing List</h1></center>
DONE

if (&ReadParse(*input)) {
if ("$input{'E-mail'}" eq "") {
  print "ERROR:  No e-mail address received.  Please try again.";
} else {

open (DATAFILE,"address.list");
$address = <DATAFILE>;
while ($address) {
  chop $address;
  if ($address eq $input{'E-mail'}) {
    $input{'E-mail'} = "";
  }
  $address = <DATAFILE>;
}
close (DATAFILE);

if ("$input{'E-mail'}" eq "") {
  print "That e-mail address is already on the list.  Nothing done.";
} else {

open (DATAFILE,">> address.list");
print DATAFILE $input{'E-mail'},"\n";
close (DATAFILE);
open (DATAFILE,">> info.list");
foreach $var (sort keys(%input)) {
  print DATAFILE $var, ":  ",$input{$var},"\n";
}
print DATAFILE "======================================================================\n";
print "The address <tt>$input{'E-mail'}</tt> has been added to the list.";

### Generate the form, we didn't get any data

}}} else {print <<DONE;

Kenny Kramer wants to keep all Seinfans on the 'net happy and up-to-date
with the latest development regarding the Seinfeld Reality Tour!
<p>Just fill out the form below and click on <b>Submit</b> and you'll
be the first to know when there's any news.

<p>If your browser is not capable of forms, e-mail
<a href="mailto:kramer@bway.net">kramer@bway.net</a>.

<FORM METHOD="POST"><table><tr><td>
E-mail address:</td><td><INPUT name="E-mail" SIZE=50></td></tr>
<tr><td>Real name:</td><td><input name="RealName" size=50></td></tr>
<tr><td>Address:</td><td>
<textarea name="Address" rows=5 cols=50></textarea></td></tr>
<tr><td>Sex:</td><td><SELECT NAME="Sex" SIZE=2><OPTION VALUE="male">Male
<OPTION VALUE="female">Female</select></td></tr>
<tr><td>Date of Birth:</td><td><select name="MonthOfBirth" size=1>
<option value="January">January
<option value="February">February
<option value="March">March
<option value="April">April
<option value="May">May
<option value="June">June
<option value="July">July
<option value="August">August
<option value="September">September
<option value="October">October
<option value="November">November
<option value="December">December</select>
<select name="DayOfBirth" size=1>
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31
</select>, 19<input name="YearOfBirth" size=2 maxlength=2>
</td></tr></table>

<P><INPUT TYPE="submit" value="Submit">
<INPUT TYPE="reset" value="Reset"><p></form>
DONE
}

print <<DONE;
<hr>Kramer's Mailing List was created by
<a href="http://jeff.aaron.com/~jmaaron/">Jeffrey Aaron</a>.
<dt>Click <a href="http://bway.net/~kramer/">here</a> to go back to Kramer's Home Page.
DONE
