View Full Version : Howto strip code?
HakkieDEV
06-20-2004, 06:39 PM
I would like to strip the input of users.
I want to strip characters from a inputfield like :'{"}[]/
How do I do that?
Xenon
06-20-2004, 06:42 PM
per str_replace would be the easiest:
$string = str_replace(array('{', '[', ...), array('', '', ...), $string);
HakkieDEV
06-20-2004, 07:08 PM
Works very well, but it doesn't work with ' or ".
How can I strip the code for those as well? (Or is that unpossible?
Xenon
06-20-2004, 08:14 PM
hmm, it should work with quotes as well.
you just have to put the " into ' and the ' into " ^^
it may be that the the quotes are already htmlspecialized, so you might use that:
$string = str_replace(array('"', "'", ...), array('', '', ...), $string);
HakkieDEV
06-20-2004, 08:23 PM
Aaah, I tried to do ''' and it gave a parse error ofcourse. :)
Thanks alot, really helpfull and its working as a charm.
Xenon
06-20-2004, 08:52 PM
:)
you're welcome :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.