gpt4 book ai didi

php - FILTER_VALIDATE_EMAIL 是否使字符串可以安全地插入数据库?

转载 作者:可可西里 更新时间:2023-11-01 13:51:36 25 4
gpt4 key购买 nike

$str = '"mynam@blabl"@domanin.com';

filter_var($str, FILTER_VALIDATE_EMAIL);//return valid email.

上面的电子邮件返回 true... RFC 2822 说它是一个合法的电子邮件地址。

我的问题是,如果您使用上述方法验证电子邮件,即使您已使用 filter_var 对其进行过滤,电子邮件是否会携带可能损害数据库的 sql 注入(inject)?

最佳答案

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 不是mysql_real_escape_string() 这样的数据库特定卫生设施的替代品!人们也需要始终应用这一点。

关于php - FILTER_VALIDATE_EMAIL 是否使字符串可以安全地插入数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4154685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com