coar 98/04/24 04:00:34
Modified: . bugdb.cgi Log: Change 'chop's to 'chomp's, and add rudimentary email address syntax validation. PR: 2135 Submitted by: Dean Gaudet Revision Changes Path 1.27 +12 -6 apache-site/bugdb.cgi Index: bugdb.cgi =================================================================== RCS file: /export/home/cvs/apache-site/bugdb.cgi,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- bugdb.cgi 1998/02/22 02:18:17 1.26 +++ bugdb.cgi 1998/04/24 11:00:33 1.27 @@ -115,6 +115,8 @@ # even to closed PRs, without spamming people. # 01/20/1998 Ken Coar - Simplify the canned message handling by using # sentinels. +# 04/24/1998 Ken Coar - change "chop" to "chomp" in a few places, add +# email syntax validation (Dean Gaudet's suggestion). # ### End Modification log @@ -252,7 +254,7 @@ ### Main menu } elsif ($PATH_INFO eq "") { &main_menu(); - print "<HR><SMALL>Version: 20 January 1998<BR>Authors: ", + print "<HR><SMALL>Version: 24 April 1998<BR>Authors: ", "<A HREF=\"http://alumni.caltech.edu/~dank/gnats.html\">Dan Kegel ", "and Huy Le</A>, <BR> ", "with revamp work by ", @@ -387,7 +389,7 @@ # Get arguments local($_)=scalar(<STDIN>); - chop; s/\r$//; + chomp; s/\r$//; local($i,%input); undef(%fieldvalues); # Global! foreach (split(/&/)) { @@ -416,13 +418,17 @@ local ($fieldval) = $fieldvalues{$field}; $fieldval =~ s/\s//g; if ($fieldval eq "") { - push (@emsgs, $field); + push (@emsgs, $field . " is blank"); $ok = 0; } } + if ($fieldvalies{'emailaddr'} !~ m:[EMAIL PROTECTED]:) { + push (@emsgs, "Email address is invalid"); + $ok = 0; + } if (! $ok) { print "<H3>Problem report not sent!</H3>\n"; - print "Your problem report is missing required information:\n"; + print "Your problem report has missing or invalid required information:\n"; print "<UL>\n"; foreach $field (@emsgs) { print " <LI>$field\n </LI>\n"; @@ -644,7 +650,7 @@ # Get arguments local($_)=scalar(<STDIN>); - chop; s/\r$//; + chomp; s/\r$//; local($i,%input); foreach (split(/&/)) { ++$i; @@ -713,7 +719,7 @@ $ed_err = "$errmsg\nError: can't run $DATEPROG"; last LOCKED; } - chop($date=<DATE>); + chomp($date=<DATE>); close(DATE); $mail_to{&tolower($nEditor{$input{'Editor'}})} = 1;