Re: Re: security in guest book and user forums

From: Date: Sun, 05 Jan 2003 02:07:03 +0000
Subject: Re: Re: security in guest book and user forums
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130285@lists.php.net to get a copy of this message
on 05/01/03 5:24 AM, Seraphim (h.b.oost@student.utwente.nl) wrote: > I use the htmlspecialchars() function to disable all html. This function > basically puts a '\' in front of eacht html character and thus disables all > html. > You may not want to do this if you want to allow, for example <b></b> or > other friendly html. If so you can use a regex to disable the <script> or > </table> tags. > > Now that I think about it, it might be better to disable all html and later > enable <i>,<b> etc (or define your own, like a lot of forums seem to do). What about striptags()? Designed EXACTLY for disabling HTML tags, except for a list you allow: <? $text = stiptags($text,'<b><i>'); // allows bold and italics ?> Justin

« previous php.general (#130285) next »