可能重复:
Best way to stop SQL Injection in PHP
The ultimate clean/secure function
我的网站被攻击通过sql注入,现在我需要改进它。我正在PHP中创建一个函数,它返回字符串的转义版本。我不是黑客,所以请帮助我改进我的逃逸功能。以下是当前版本:
function escape($string){
$string = stripslashes($string);
$string = mysql_real_escape_string($string);
$string = strip_tags($string);
$string = str_replace('%','',$string);
$string = str_replace('_','',$string);
return $string;
}
我的问题是:如果它比如何修复它更容易被破解吗?谢谢!
发布于 2012-03-31 16:26:56
这一功能与安全毫无关系。
它几乎无法保护你不受某些类型的XSS注射。就这样。
https://stackoverflow.com/questions/9957401
复制相似问题