Skip to content

Instantly share code, notes, and snippets.

@wilnaweb
Created February 11, 2020 22:57
Show Gist options
  • Save wilnaweb/20a9ffbc44033c6636fa00c2f0fed7e5 to your computer and use it in GitHub Desktop.
Save wilnaweb/20a9ffbc44033c6636fa00c2f0fed7e5 to your computer and use it in GitHub Desktop.
Check if exist sql command into string
function existSqlCommand($param){
$notAllowedCommands = array(
'DELETE',
'TRUNCATE',
'DROP',
'SELECT',
'UPDATE'
);
if(preg_match('[' . implode(' |', $notAllowedCommands ) . ']i', $param) == true) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment