我是PHP的新手,基本上我正在尝试为我的网站创建一个评论系统.我有以下功能:
$ input = $ _POST ['comment'];
function cleanUserInput($ input){$ input = mysql_real_escape_string($ input); $ input = htmlentities($ input); return $ input; }
所以问题是,mysql_real_escape_string是否足以阻止sql注入?并且htmlentities()是否足以阻止用户输入的脚本,html和样式具有实际效果并且只显示为文本?
或者我是否需要在我的函数中添加更多内容才能使输入真正无害?
php ×1