http://qs321.pair.com?node_id=603485


in reply to Re^3: Making a regex case insensitive
in thread Making a regex case insensitive

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^5: Making a regex case insensitive
by imp (Priest) on Mar 06, 2007 at 18:49 UTC
    You shouldn't ever directly include data that is provided by a user in your SQL. It should always be bound, or quoted where binding isn't available.
    # Interpolated ... bad my $sql = "insert into hits (browser) values ('$ENV{HTTP_USER_AGENT}') +" $dbh->do($sql); # Bound ... best my $sql = "insert into hits (browser) values (?)"; $dbh->do($sql, {}, $ENV{HTTP_USER_AGENT}); # Quoted ... tolerable my $sql = sprintf "insert into hits (browser) values (%s)", $dbh->quot +e($ENV{HTTP_USER_AGENT}); $dbh->do($sql);
    It is trivial for users to modify their user agent string, never trust users.
    A reply falls below the community's threshold of quality. You may see it by logging in.