...

View Full Version : HTML entities problem



DesignersToolz
04-01-2004, 08:15 PM
I am using this code to stop parsing of posted code on my forum:

$threadd = str_replace("&lt;br /&gt;","<br/>",htmlspecialchars(nl2br($thread)));



Works great. Untill someone posts a single quote.

Example of the problem:

user posts: don't
post comes out as: don\'t


Same with double quotes.

Whats up with this?

Thanks. :cool:

raf
04-01-2004, 08:21 PM
I suppose you have magic_quotes turned on

http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-runtime

If so, then turn it off or use a stripslashes() on every output

(If you ask me, magic_quotes are probably the most stupif thing ever added to PHP. You never know what setting another host will have and it can realy mess up your script)

DesignersToolz
04-01-2004, 08:27 PM
That'll do thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum