> I'm having a problem with HTMLspecialchars and nl2br interfearing with
> each other.  Obviously, I'm trying to stop malicous HTML/scripts from
> being entered into my guestbook, but I'm also trying to add spacing.
> nl2br adds <br>, but HTMLspecialchars tells it to not show that.
> 
> Anyways, I'm sure there is a way around this.  All help is welcome, so
> I'm eager for replys.  Thank you very, very much!

<?

// Malicious content (don't laugh, I've had this happen!)
$content = "<FRAMESET>\n"
          ." <FRAME SRC='whee'>\n"
          ." <FRAME SRC='whee1'>\n"
          ."</FRAME>";

// Convert < to &lt;, etc
$output = htmlentities($content);

// change newlines to <BR>s
$output = nl2br($output);

?>

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to