in reply to Re^2: Simple question on SQL Injection
in thread Simple question on SQL Injection
You can't vary the table name with placeholders, nor field names. They only work with values. However, if you're consistent in your naming, and only use a limited set of characters, you can test to see if input is safe, even if not valid. (for instance, only letters, digits, and underscores)
warn "Invalid value" if ( $input =~ m/\W/ );note -- '\W' matches any character not matched by '\w', which matches letters, numbers, and underscore. The list of what qualifies as a 'letter' is dependant upon your locale settings. If you wanted only ascii letters, use the following:
warn "Invalid value" if ( $input =~ m/[^a-zA-Z\d_]/ );
|
|---|