Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI; print header(); #print "Test"; my $userip = $ENV{'REMOTE_ADDR'}; #print $userip; my $curr_dir; #print $userip; # Grab the current directory from $0. BEGIN { $0 =~ '(.*[\\\/])\w+\.\w+$'; $curr_dir = $1 || "./"; } my $display = &filter($q->param('display')) || ''; my $insert = &filter($q->param('insert')) || ''; my $confir = &filter($q->param('confir')) || ''; my %AoH; if($insert eq "insert"){ $AoH{MESS} = "OK your message has been received!"; }else{ $AoH{MESS} =""; } print "<br><b>I must to print these values here once the buttons on th +e form has been clicked:</b><br>***INSERT=$insert******DISPLAY=$displ +ay******CONFIR=$confir######<br>"; my $out_file; $out_file = "${curr_dir}table.html"; open(OUTPUT, "$out_file") || print "L40 - There is no file here, I'll +run away now!"; while(<OUTPUT>) { $_=~s/<!-- (\bMESS\b)\/\/ -->/$AoH{MESS}/g; print $_; } close OUTPUT; ####################################### ### Filter - Gets rid of characters that screw up the program. sub filter { if($_[0]){ $_[0]=~s/\s+$//; $_[0]=~s/\'/\\\'/g; $_[0]=~s/<//g; $_[0]=~s/>//g; $_[0]=~s/;//g; $_[0]=~s/\(//g; $_[0]=~s/\)//g; $_[0]=~s/\"//g; $_[0]=~s/\'//g; $_[0]=~s/\?//g; $_[0]=~s/\<script//g; #$_[0]=~s/\///g; $_[0]=~s/>//g; #$_[0]=~s/\%2F//g; return $_[0]; }else{ return ''; } } ### End Filter Sub
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3 +.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Test</title> </head> <body> Test<br> <form name="upf" method="post"> <input type="hidden" name="update" value="update"> <input type="submit" name="upf" value="Cancel" onClick="docum +ent.upf.action='test.pl';"> <br><br> <input type="submit" name="upf" value="Insert" onClick="docum +ent.upf.action='test.pl?insert=insert';"> <br><br> <input type="submit" name="upf" value="Confirm" onClick="docu +ment.upf.action='test.pl?confir=confir';"> </form> <!-- MESS// --> </body> </html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing Parameters Help!
by blazar (Canon) on Jul 11, 2007 at 08:05 UTC | |
|
Re: Passing Parameters Help!
by moritz (Cardinal) on Jul 10, 2007 at 15:09 UTC | |
by blazar (Canon) on Jul 10, 2007 at 22:25 UTC | |
|
Re: Passing Parameters Help!
by rpanman (Scribe) on Jul 10, 2007 at 17:32 UTC | |
by Marmota_11 (Initiate) on Jul 10, 2007 at 18:49 UTC | |
by rpanman (Scribe) on Jul 11, 2007 at 10:56 UTC | |
|
Re: Passing Parameters Help!
by cool (Scribe) on Jul 10, 2007 at 15:24 UTC | |
by Anonymous Monk on Jul 10, 2007 at 15:54 UTC | |
by roboticus (Chancellor) on Jul 11, 2007 at 10:53 UTC | |
by Anonymous Monk on Jul 11, 2007 at 09:03 UTC |