Simple php function to validate html tags in given content. In some cases we need to check if the given string contains html tags in order to avoid hacking attends and also to avoid unwanted elements changing the layout of our site.
function validateHtmlSafe($value) {
return (bool)(!preg_match("/<(.*)>.*<$1>/", $value));
}
function validateHtmlSafe($value) {
return (bool)(!preg_match("/<(.*)>.*<$1>/", $value));
}
No comments:
Post a Comment