This short article will talk about protecting your web forms from users who may try to exploit your website by entering in HTML into a text box.
Validation is something all web coders should think about as it protects the end user from making mistakes and protects your website from malicious attacks.
The following code uses the “htmlspecialchars” PHP function to strip all HTML tags from the entered data and then puts back what is allowed according to what YOU set.
!i', create_function('$matches','return str_replace(array(">", "<", """, "&"), array(">", "<", "\"", "&"), $matches[0]);'), $content);
?>
No related posts.