FILTER_VALIDATE_EMAIL是否使字符串安全插入数据库? [英] Does FILTER_VALIDATE_EMAIL make a string safe for insertion in database?
问题描述
$ str ='mynam @ blabl@ domanin.com';
filter_var($ str,FILTER_VALIDATE_EMAIL); //返回有效的电子邮件。
上述电子邮件返回true ...公平的RFC 2822说这是一个合法的电子邮件地址。 / p>
我的问题是,如果您使用上述验证电子邮件,电子邮件是否携带sql注入,即使您已使用filter_var过滤数据库,也可能会损坏数据库?
我的问题是,如果您使用上述验证电子邮件,则电子邮件携带可能会损坏数据库的sql注入虽然你已经过滤了filter_var?
filter_var
是 替换数据库特定的卫生设备,如 mysql_real_escape_string()
!一个人也需要总是适用。
$str = '"mynam@blabl"@domanin.com';
filter_var($str, FILTER_VALIDATE_EMAIL);//return valid email.
the above email returns true... Fair enough that RFC 2822 says it's a legal email address.
my question is if you validate an email using the above could an email carry sql injections that can harm the db even though you have filtered it with filter_var?
my question is if you validate an email using the above could an email carry sql injections that can harm the db even though you have filtered it with filter_var?
filter_var
is not a replacement for database specific sanitation like mysql_real_escape_string()
! One needs to always apply that, too.
这篇关于FILTER_VALIDATE_EMAIL是否使字符串安全插入数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!