#!/srvtools/http/bin/perl
# Falke Bruinsma (falke@innersource.com)
# Inner Source Computer Services, Inc. (http://www.innersource.com)
#

require 'cgi-lib.pl';
require 'defines.pl';

MAIN:
{
  if (not &ReadParse(*input)) {
    CgiError("Error", "Parameters were expected and none were given.");
    exit;
  }
  print &PrintHeader;
  print <<EOF;
<HTML>
<HEAD> 
<TITLE>Submitted New Entry</TITLE>
</HEAD>
<BODY>
<H2>Thank you!</H2>
<HR><P>
Your info has been submitted and will be added to the database after
being reviewed...
<HR>
Back to:
<A HREF="$home/highschools/index.html">High School Homepage Directory</A> |
<A HREF="$home/index.html">
The Student Center Main Page</A> 
</BODY>
</HTML>
EOF
  submit_event();
}

sub submit_event {
  if ($input{'name'} eq '') { $input{'lastname'} = $E_NAME;}
  if ($input{'url'} eq 'http://') { $input{'url'} = $E_URL; }
  if ($input{'city'} eq '') { $input{'email'} = $E_CITY; }
  if ($input{'state'} eq '') { $input{'dob'} = $E_STATE; }

  if (!open (LIST, ">>$submit_file")) {
    print $ErrorMessage;
    exit(1);
  }
  print LIST "$input{'name'}\n$input{'url'}\n";
  print LIST "$input{'city'}\n$input{'state'}\n\n";
  close(LIST);
}

