Update: ctweten pointed out that your URL is definitely legal. Thanks!

To be honest, I'm not sure that you're URL is legal. Try a url like the following:

http://lezar.org/path/to/script/myscript?where=someval
/path/to/script/myscript should be the path and name of your script. where=somval is a name value pair that gets passed to the query string.

Then, use CGI to get the name/value pairs. You also shoudl use taint checking (that's the -T switch on the shebang line) and use strict to catch all sorts of problems. Here's an updated version of what you want to do:

#!/usr/bin/perl -wT use strict; use CGI qw/:standard/; my $taintedWhere = param( 'where' ); my $where = ( $taintedWhere =~ /(\w+)/ ); if ( $where eq 'Front' ) { print header; print <<" Mn"; Some HTML Mn } elsif ( $where eq 'WebMail' ) { print header; print <<" WbMl"; Some more HTML WbMl } else { # $where is not what we expect, so we have an error routine here; }
See perlsec for information on the security issues and you can also check out my online CGI course for further information. It's not complete, but it should give you a good start.

For easier debugging, try adding the following line to your script:

use CGI::Carp qw( fatalsToBrowser );
That will usually print useful debugging information to the browser. Just make sure that you remove this when you put the script on a production server! There's no sense proving crackers with additional information about how your script works.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re: Stuck by Ovid
in thread Stuck by Anonymous Monk

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.