I have a textarea where user can add something. To avoid inserting HTML i use following PHP functions
on textarea?
$text = addslashes(strip_tags(htmlspecialchars($_POST['message'])));
A message from the user is looks like in the DB like below.
8KsAtP <a href="http://lqexajgwyrsk.com/">lqexajgwyrsk</a>,
[url=http://imndawriqhnk.com/]imndawriqhnk[/url],
[link=http://qyozfozrqier.com/]qyozfozrqier[/link],
http://oykrvybeqata.com/
My Question is that how can i check there is HTML code in textarea, instead of inserting it in DB like above i want to show error message.
My Question is different to How to prevent XSS with HTML/PHP? in the way that I am asking how to check if there is html or link in field. and answer on this question how can i check is also provided by Dale. While this question is asking about how to prevent. and i already use functions given in this answer.