开发者

sanitizing html user inputs in php codeigniter

I have a user form where users can post comment on articles. i need to allow strong, em and span tags for user inputs. I know this can be achieved through strip_tags function but i also want the other tags not to stripped but be changed using say htmlspecialchars function so that tags can be seen in the page. 开发者_运维技巧I hope it made sense.


Strip tags isn't safe. It'd allow a tag like <strong onmouseover="alert('xss');">mouse over this lol</strong> through. Use HTMLPurifier


I think what you are looking for is the prep_for_form validation rule found here. Additionally you probably want to use xss_clean.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜