0

I have a form which will get user information, I am parsing most of the text already. I have set up a [code] tag which will allow users to insert any code they like. Once it's submitted, it will have syntax highlighting, etc. The problem I am running into is that when using htmlentities, htmlspecialchars, or similar to sanitize bad input, we get left with some funky looking outputs sometimes from inside the [code] block. I wish for this to look exactly how the user enters it, but to not actually do any actions on the website. For instance, echo('test'); becomes echo(\'test\'); eliminating the highlighting for the string. I wish for this to be displayed exactly as: echo('test'); however, it should not execute anything to remain safe.

Thanks in advance.

Singularity
  • 271
  • 2
  • 11
  • You probably have [magicquotes](http://php.net/manual/en/security.magicquotes.php) on ? – Glavić Oct 12 '13 at 08:03
  • 1
    Yeah, all this PHP development I have done, and I have never encountered magic quotes. I learned something new today, thank you very much for your help. – Singularity Oct 12 '13 at 10:18

0 Answers0