Maybe the reason you can not see the stuff in "a.pl" is because you may need to use "print "Content-type: text/html\n\n";" before you print.
Example:#!/usr/local/bin/perl -w
use CGI qw(:standard);
#my $name = undef; # is ok, but you'll get a warning if $name is blank
+.
my $name = param("name") || ''; # better for warn!
print "Content-type: text/html\n\n"; # Setup the header for the browse
+r
print "value = ",$name, "\n";
Once you Get your code to work. I want you to remember to check the param() inputs before you print them, if its going to be used in a public web page!
As your "a.pl" sits now anyone could inject HTML and Javascript codes. that is a security risk if your going to let people you dont trust use the script.
Here is an Example of how to secure your param():
print "Content-type: text/html\n\n"; # Setup the header for the browse
+r
my $name = param("name") || '';
# Allow only numbers, letters and _
if ($name && $name !~ m/^[0-9A-Za-z_]+$/i) {
print 'Error: Bad input Format';
exit; # Stop script
}
If the code needs a number and no letters just check for numbers in that param().
Good Luck!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.