Salve,
volevo sapere se questa funzione a cui passo dati provenienti da form compilati dagli utenti serve per prevenire l' sql injection e se è sufficiente, ossia è comunque abbastanza sicura:
Codice PHP:
function checkstring ($str){
$forbidden=array("<", // HTML + logical operator
">", // HTML + logical operator
"'", // SQL string operator
"\"", // SQL string operator
"%", // SQL string operator
// ">", // special character
// "<", // special character
";" // Commands terminator for lots of prog languages
);
for ($i=0; $i<count($forbidden); $i++) {
$repl=$forbidden[$i];
$str=str_replace("$repl","",$str);
}
return ($str);
}