I have some older code to maintain and I am worried about SQL injections, but I cannot use PDO. I would like instead to have a top level PHP function to examine $_GET and $_POST and stop the script if anything suspicious is found.
What would be a good function to write at this point? For example, I could start with that:
$flag = 0;
$req = array_merge($_GET, $_POST);
foreach ($req as $rx)
{
if (strpos(strtolower($rx), 'drop ') !== false)
$flag = 1;
if (htmlspecialchars($rx,ENT_QUOTES) !== $rx)
$flag = 1;
....
}
Thanks.