tcf03 has asked for the wisdom of the Perl Monks concerning the following question:
andif (defined(param('SERVER_NOTES')) =~ m/\w+/ )
amongst several others...if (! defined(param('SERVER_NOTES)) !~ m/\W+/ )
#!/usr/bin/perl -T use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use Data::Dumper; #$CGI::POST_MAX=1024 * 100; # max 100K posts #$CGI::DISABLE_UPLOADS = 1; # no uploads # Clean up our UNIX environment # for more infor read perldoc perlsec $ENV{'PATH'} = '/bin:/usr/bin'; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; $|++; my @text; if ( defined (param('NOTES')) =~ m/\w+/ ) { @text=param('NOTES'); open (SERVER_NOTES, ">/var/www/cgi-bin/notes") or die("Unable to open notes: $!\n"); for my $text(@text) { print SERVER_NOTES "$text\n"; } close (SERVER_NOTES); } ## Start HTML ## print header; print start_html(-title=>"AWI Printer Administration - printer notes", -BGCOLOR=>"#cccc99" ), "\n"; print "<tt><center>\n"; print h3("AWI", "Printer", "Administration"),"\n"; print "</center>\n"; print hr,"\n"; # End header print br,br; if ( -s "/var/www/cgi-bin/notes" ) { print Delete_all(); open FH, "/var/www/cgi-bin/notes" or die("unable to open notes: $!\n"); my @new_text=<FH>; print "<center>\n"; print textarea('SAID',"@new_text", 15, 80, 0), "\n", br, br; print "</center>\n", br; #for (@text) { print }; } print br,br,br; print start_form; print "\n<center>\n"; print h3("Change printer notes"); print textarea('NOTES',"", 15, 80), "\n",br; print submit('Submit'); print "</center>\n",br; print Dumper @text; print end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple CGI text editing
by Joost (Canon) on May 04, 2005 at 14:22 UTC | |
by tcf03 (Deacon) on May 04, 2005 at 14:26 UTC |