Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
my $nick = $cgi->param('nick'); ... my $wpage = $cgi->param('wpage'); my $nick = encode_entities($nick, '<>&"'); ... my $wpage = encode_entities($wpage, '<>&"');

Not to address any security hole but just to simplify and DRY out the code a bit, you might try one of these untested approaches.

my ($nick, $pic, $say, $likes, $fav, $car, $age, $town, $drink, $wpage +) = map { encode_entities($cgi->param($_), '<>&"') } qw ( nick pic say likes fav car age town drink wpage +);
Or else (and better IMHO):
use constant CGI_PARAMS => qw( nick pic say likes fav car age town drink wpage ); my %param = map { $_ => encode_entities($_, '<>&"') } map { $cgi->param($_) } CGI_PARAMS ; ... print $fh <<"EOHTML"; <b>$param{'nick'}</b><br> <img src='$param{'pic'}' width='250' height='auto' border='2'><br> <br> Says <b>$param{'say'}</b><br> Likes <b>$param{'likes'}</b><br> Favorite vehicle <b>$param{'fav'}</b><br> Real life car/vehicle <b>$param{'car'}</b><br> Age <b>$param{'age'}</b><br> Hometown <b>$param{'town'}</b><br> Favorite drink <b>$param{'drink'}</b><br> <b><a href='$param{'wpage'}'>$param{'wpage'}</a></b> <HR color=#008000 SIZE=2> EOHTML


Give a man a fish:  <%-{-{-{-<


In reply to Re^2: Any security holes? by AnomalousMonk
in thread Any security holes? by Limbomusic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found