Ho letto in qualche manuale che addslahses NON è sicuro: perchè?
Premetto che faccio questa domanda in quanto effettuo già una specie di htmlspecialchars con questa funzione:
Codice PHP:
function my_htmlspecialchars( $html )
{
$text = array ( "<" , ">" , "\"" , "'" );
$replace = array ( "<" , ">" , """ , "'" );
return str_replace( $text , $replace , $html );
}
E dato che utilizzo sprintf/vsprintf per le query, utilizzare anche mysql_real_escape_string renderebbe le query a dir poco lunghissime.
In parole povere: basta che utilizzo my_htmlspecialchars ( che definisco comunque dato che estraggo tutte le informazioni come il referer, user agent etc... all'inizio dello script ) per prevenire attacchi di tipo sql injection o devo per forza utilizzare ANCHE mysql_real_escape_string?
grazie.