#!/usr/bin/perl -T
use strict;
use warnings;
use DBI;
use CGI;
use Data::Dumper;
my $cgi = CGI->new;
print $cgi->header(-type => 'text/plain');
my $dbh = DBI->connect(qw(dbi:mysql:test user pass), {RaiseError=>1, Taint=>0, TaintIn=>1, TaintOut=>0});
my $id;
($id = $cgi->param('id')) ? get_user() : normal_page();
sub get_user {
my $sth = $dbh->prepare('select * from user where id = ?');
#($id) = $id =~ /^(\d+)$/;
$sth->execute($id);
my $user = $sth->fetchrow_hashref;
$sth->finish;
die "There's no such user id ($id)\n" unless defined $user;
print Dumper($user);
}
sub normal_page {
print 'Hello there';
}
####
Insecure dependency in parameter 1 of DBI::st=HASH(0x8265f88)->execute method call while running with -T switch at /path/to/user.cgi line 20.
####
$VAR1 = {
'pass' => 'perl',
'location' => undef,
'name' => 'perl',
'id' => '1'
};