CGI Paramater Validation Simple Validation 2 of 32 : [PREV] [NEXT]

Quick & Dirty

Its your first CGI script and you have a form passing some values. To get them into your script you use CGI.pm

#!/usr/bin/perl
use CGI;

$cgi = new CGI();
$action = $cgi->param('action');

We're already skirting danger, but we carry on. We now use our action to load a file.

open FILE, "$action" or die "cannot open file: $!\n";

What if the user had posted

rm -rf /;echo 'oh dear!'

Oops!


© 2003 Barbie barbie@missbarbell.co.uk Home http://birmingham.pm.org/