/ Published in: PHP
Stripping out malicious code
Expand |
Embed | Plain Text
<?php function cleanInput($input) { '@<script[^>]*?>.*?</script>@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@<style[^>]*?>.*?</style>@siU', // Strip style tags properly '@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments ); return $output; } ?>
Comments
Subscribe to comments
You need to login to post a comment.

the strip_tags() function will achieve the same