arrow has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl print "Content-type: text/html\n\n"; use CGI::Carp qw(fatalsToBrowser); #use strict; use CGI; my $q = new CGI; my @exp = $q->param("explorer"); my $hoursworked = $q->param("hrswrked"); my $name = $q->param("name"); my $num = @exp; (my $sec,my $min,my $hour,my $mday,my $mon,my $year,my $wday,my $yday, +my $isdst)=localtime(time); my $month = $mon+1; my $year1 = $year+1900; my $date = "$month\/$mday\/$year1"; my @months = qw(January February March April May June July August Sept +ember October November December); if ($q->param("submit")) { if (($hoursworked eq "") || ($num == 0)) { print <<"PrintTag"; <html><head><title>Insufficient information</title> </head><body bgcolor = "white" text="black" link="black"> <BASE HREF="http://nbpdexplorers.port5.com/"> <br><br><center><h2>Insufficient information</h2></center> <blockquote><blockquote><center><p><b>The following field(s) were empt +y:<br><br> <table> PrintTag if ($hoursworked eq "") { print "<tr><td><li><b>Hours Worked</b></li></td></tr>"; } if ($num == 0) { print "<tr><td><li><b>Explorers</b></li></td></tr>"; } print <<"PrintTag"; </table></p></center></blockquote></blockquote> <center><h3>Please click the \'Back\' button on your browser to try ag +ain</h3></center></html> PrintTag exit; } @exp = sort(@exp); @date = split(/\//, $date); $month = shift(@date); $month--; $month = @months[$month]; open(DATA, ">>/host/n/b/p/p/o/r/nbpdexplorers.port5.com/cgi-bin/data2. +txt") or die "Cannot open database file: $!"; flock(DATA, 2); print DATA "$month\+$exp[0]"; print DATA "\+$exp[1]" if exists $exp[1]; #print DATA "\+$exp[2]" if exists $exp[2]; #print DATA "\+$exp[3]" if exists $exp[3]; #print DATA "\+$exp[4]" if exists $exp[4]; #print DATA "\+$exp[5]" if exists $exp[5]; #print DATA "\+$exp[6]" if exists $exp[6]; #print DATA "\+$exp[7]" if exists $exp[7]; #print DATA "\+$exp[8]" if exists $exp[8]; #print DATA "\+$exp[9]" if exists $exp[9]; #print DATA "\+$exp[10]" if exists $exp[10]; #print DATA "\+$exp[11]" if exists $exp[11]; print DATA "\+$hoursworked\n"; } flock(DATA, 8); close(DATA); } print <<"PrintTag"; <html><head><title>Record Accepted</title> </head><body bgcolor = "white" text="black" link="black"> <BASE HREF="http://nbpdexplorers.port5.com/"> <br><br><center><h2>Request Add Record Accepted</h2></center><br><br> <blockquote><blockquote><center><p><font size="+1">To check hours work +ed status or to edit explorer listing, click <a href="http://nbpdexpl +orers.port5.com/cgi-bin/mainpage.cgi?name=$name">here</a></font></p>< +/center></blockquote></blockquote> <br><br><br><br><br><br><br><br><br><br><blockquote><blockquote><cente +r><p><font size="+1"><a href="http://nbpdexplorers.port5.com">Click H +ere To Log Off</a></font></p></center></blockquote></blockquote> PrintTag
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: exists and defined functions
by rob_au (Abbot) on Nov 20, 2002 at 21:12 UTC | |
by tye (Sage) on Nov 20, 2002 at 22:09 UTC | |
|
Re: exists and defined functions
by tadman (Prior) on Nov 20, 2002 at 21:30 UTC | |
|
Re: exists and defined functions
by robartes (Priest) on Nov 20, 2002 at 20:58 UTC | |
|
Re: exists and defined functions
by arrow (Friar) on Nov 20, 2002 at 22:11 UTC | |
|
Re: exists and defined functions
by insensate (Hermit) on Nov 20, 2002 at 20:49 UTC | |
|
Re: exists and defined functions
by arrow (Friar) on Nov 20, 2002 at 22:14 UTC |