#! /usr/bin/perl

use CGI qw(:standard);
# Collect cookie, write file
$username=remote_user();
if ($username eq "") {$username="Simon";}
$comments=cookie('NotePad');
# Need date as well
$datestamp=localtime;

if (($comments) && ($comments ne " ")) {
  open (COOKLIST, ">>C:/comments/$username.txt") || die "open: $!";
  print COOKLIST p("$username, $datestamp");
  print COOKLIST p($comments);
  close (COOKLIST);
  print header();
  print start_html("Comments Submission"), h1("Comments Submission");

  print p("Thank you for submitting your comments.  The full list of your comments follows:");

  print hr();
  #read file, print to screen
  open (COOKLIST, "C:/comments/$username.txt") || die "open: $!";
  while (<COOKLIST>) {
    chomp;
    print "$_ <BR>";
  }
  close (COOKLIST);

  print hr();
  print p("Your comments, once submitted, will be available to all project management personnel as well as any technical personnel.  While  most users are restricted from seeing all comments from all personnel, they should not assume that comments are private.");
}
else {
  print header(), start_html("Please enter some comments");
  print h1("No comments submitted");
  print p("We can't accept your comments until you have entered some.");
  print p("Please <A HREF='../../notepad.htm'>enter some comments.</A>");
}
print end_html();