<?php
function strip_html_tags( $text )
{
$text = preg_replace(
array(
// Remove invisible content
'@<head[^>]*?>.*?</head>@siu',
'@<style[^>]*?>.*?</style>@siu',
'@<script[^>]*?.*?</script>@siu',
'@<object[^>]*?.*?</object>@siu',
'@<embed[^>]*?.*?</embed>@siu',
'@<applet[^>]*?.*?</applet>@siu',
'@<noframes[^>]*?.*?</noframes>@siu',
'@<noscript[^>]*?.*?</noscript>@siu',
'@<noembed[^>]*?.*?</noembed>@siu'
),
array(
'', '', '', '', '', '', '', '', ''), $text );
return strip_tags( $text);
}
function make_safe($variable) {
$variable = strip_html_tags($variable);
$bad = array("=","<", ">", "/","\"","`","~","'","$","%","#");
$variable = str_replace($bad, "", $variable);
$variable = (trim($variable));
echo $variable;
}
make_safe("<p style="'color: red;'">Test-Absatz. </p>");
?>
- Output for 5.4.0 - 5.4.29
- Parse error: syntax error, unexpected ''color: red;'' (T_CONSTANT_ENCAPSED_STRING) in /in/cMitO on line 32
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /in/cMitO on line 32
Process exited with code 255.
preferences:
190.14 ms | 1395 KiB | 66 Q