To be honest, I'm not sure that you're URL is legal. Try a url like the following:
/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.http://lezar.org/path/to/script/myscript?where=someval
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:
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.#!/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; }
For easier debugging, try adding the following line to your script:
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.use CGI::Carp qw( fatalsToBrowser );
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |