#!/usr/bin/perl -wT use strict; use CGI; my $q = CGI->new; # Grab all data my $_somename = $q->param( 'somename' ); # hidden my $_name = $q->param( 'name' ); # text my @_group1 = $q->param( 'group1' ); # checkbox my $_pass = $q->param( 'pass' ); # password my @_sports = $q->param( 'sports' ); # select my @_test = $q->param( 'test' ); # textarea my $_radio1 = $q->param( 'radio1' ); # radio my @_religions = $q->param( 'religions' ); # select my $_asdf = $q->param( 'asdf' ); # select my $__submit = $q->param( '.submit' ); # submit # The following is just a rough "fill in" template for untainting your data. # It will need to be customized to suit your particular needs. You'll need # to create regular expressions to untaint your data and if you skimp on this, # it's at your peril!!! # These are NOT efficient regexes. For large forms with many similar data values # for the same name, this could be quite slow. I had considered making these more # efficient by having separate regex tests for each value, but since the user still # needs to go in and tweak them, I didn't see the point. # hidden values: asdf my ( $somename ) = ( $_somename =~ /^(asdf)$/ ); # text values: Ovid my ( $name ) = ( $_name =~ /^( # could not auto-create regex # )$/ ); # checkbox values: 1,2 my @group1; ( $group1[$_] ) = ( $_group1[$_] =~ /^([12])$/ ) foreach ( 0 .. $#_group1 ); # password values: my ( $pass ) = ( $_pass =~ /^( # could not auto-create regex # )$/ ); # select values: Tiddly winks,Mud wrestling,Twister,Jello wrestling my @sports; ( $sports[$_] ) = ( $_sports[$_] =~ /^(Tiddly\ winks|Mud\ wrestling|Twister|Jello\ wrestling)$/ ) foreach ( 0 .. $#_sports ); # textarea values: my @test; ( $test[$_] ) = ( $_test[$_] =~ /^( # could not auto-create regex # )$/ ) foreach ( 0 .. $#_test ); # radio values: ^,^,^,\,],1,2,3,4 my ( $radio1 ) = ( $_radio1 =~ /^([\^\\\]1234])$/ ); # select values: Democrat,Republican my @religions; ( $religions[$_] ) = ( $_religions[$_] =~ /^(Democrat|Republican)$/ ) foreach ( 0 .. $#_religions ); # select values: Dasdfsdf,asfdasdfasdf my ( $asdf ) = ( $_asdf =~ /^(Dasdfsdf|asfdasdfasdf)$/ ); # submit values: why bother? my ( $_submit ) = ( $__submit =~ /^(why\ bother\?)$/ );