I'm trying to validate input from PHP and possibly detect what type of attack has been attempted (if any).
...
$data = array($_POST, $_GET, $_COOKIE);
foreach($data as $entryPoint){
foreach($SQLi as $vector){
if($entryPoint==$vector){
echo 'SQLi detected';
}
}
}
...
And so I have in my $SQLi
array the following:
$SQLi = array(
'UNION ALL','SELECT','DISTINCT','AUTO INCREMENT','VERSION()',
'GROUP','CONCAT','@@VERSION','FLOOR','information_schema',
'COUNT','INSERT INTO','DROP','ORDER BY','UPDATE'
);
I wanna check if any of the elements in that array are present as values of either $_POST
, $_GET
or $_COOKIE
requests. What am I doing wrong?