Gossamer Forum
Home : Products : DBMan : Customization :

how to strip out html with this code?

Quote Reply
how to strip out html with this code?
Where can I put this code to strip out HTML code from form submissions?

Code:
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~ s/<([^>]|\n)*>//g unless ($allow_html = 1);
$value =~ s/<(.|\n)*script>//gi; # no scripts
Quote Reply
Re: how to strip out html with this code? In reply to
You could put that in parse_form(). Please note that those regexp's won't catch all html, only 99% of it..

Cheers,

Alex
Quote Reply
Re: how to strip out html with this code? In reply to
Muchos Gracias Alex. It worked first try.

Regexp's aren't perfect, but 99% of the users out there are just casual meddlers.

Thanks for the excellent script.