I want to block xss attacks but i still want to allow html tags like <b><u><i><img><a>
and YouTube video players. I don't want to be open for XSS attacks tho. I am using php.
views:
61answers:
2
+1
A:
strip_tags($string, "<b> <u> <i> <img> <a>");
This will not prevent someone from using onmouseover etc. though - you have to strip out Javascript.
Thomas O
2010-10-02 21:39:20
+2
A:
I recommend using htmlpurifier, it is the most secure tool to filter html.
I suggest you also to read this great analysis of HTML sanistisation tools for php.
Nicolò Martini
2010-10-02 21:46:13